Forum: Java Apr 1st, 2009 |
| Replies: 3 Views: 422 Yes, that is assumed. This is not part of any code, we are just asked to rewrite these loops. None of the values given are initialized either.
Ok, so for the second one I have:
int i = 0;
... |
Forum: Java Mar 31st, 2009 |
| Replies: 3 Views: 422 I am supposed to change an ordinary for loop into an enhanced for each loop. I have the following two problems:
1. for(int i = 1; i<data.length; i++)
sum = sum + data[i];
2. for(int i... |
Forum: Java Mar 4th, 2009 |
| Replies: 19 Views: 4,295 your problem is in the last for loop, because you are telling the program to output it character by character by putting the system.out.println each time. you need one system.out.println which will... |
Forum: Java Mar 4th, 2009 |
| Replies: 19 Views: 4,295 well what you got is the word in reverse. is your question why the output is 5 different lines instead of one line saying olleh? if so, look at your System.out.println and you should see it.... |
Forum: Java Mar 4th, 2009 |
| Replies: 19 Views: 4,295 do a While loop, where you say, while the word is not olleh, do... then you make a loop in which you rearrange the letters one by one, starting from the last one. |
Forum: Java Mar 4th, 2009 |
| Replies: 6 Views: 493 and how is that done exactly? i figured it must be something like that, but i dont know how to fix it |
Forum: Java Mar 4th, 2009 |
| Replies: 6 Views: 493 I do have an election class with Election(value, value.....) etc I just didn't include it since that's about all it does. The first value is the probability that the first voter actually votes, the... |
Forum: Java Mar 3rd, 2009 |
| Replies: 6 Views: 493 public class Election
{
private Voter v1;
private Voter v2;
private Voter v3;
public String winner;
int myTotal = 0;
int hisTotal = 0;
public Election(double pa1, double pv1,... |
Forum: Java Feb 17th, 2009 |
| Replies: 14 Views: 5,931 Well, first - she ;) lol. I am a female who prior to this was considering majoring in CompSci but not anymore, which would explain the lack of females in the field, I suppose.
And yes, I just... |
Forum: Java Feb 16th, 2009 |
| Replies: 14 Views: 5,931 I know but you know what, I noticed this, and I tried putting the code in the header, before my methods, and it didn't work. So I just assumed that that wasn't the problem. But I guess it was.
... |
Forum: Java Feb 16th, 2009 |
| Replies: 14 Views: 5,931 OMG ok that solved it thank you so much. Although my program is not running the way I wanted it to, it still is running nonetheless so I thank you eternally. You just made my 10+ hours pay off. |
Forum: Java Feb 16th, 2009 |
| Replies: 14 Views: 5,931 You're right, the program crashes after it displays "Enter 1 if you would like to play..." and then the error message pops up. No I don't know the difference between declaring and initializing. I... |
Forum: Java Feb 16th, 2009 |
| Replies: 14 Views: 5,931 Well, input.nextInt() is asking for the user to enter a value right (I think)? So, the user enters a value, either 0 or 1, and this stores it into human. If human>0, meaning if it is 1, then isHuman... |
Forum: Java Feb 16th, 2009 |
| Replies: 14 Views: 5,931 I'm not sure if I know what you're asking me. As far as I know, it is used every time we want user input. So I used the scanner input.scanner bla bla whenever I needed a value from the user. |
Forum: Java Feb 16th, 2009 |
| Replies: 14 Views: 5,931 this is my code - i have three classes and i will post all since i have no idea what i'm doing apparently
public class OneTwoTest
{
public static void main(String[] args)
{... |
Forum: Java Feb 16th, 2009 |
| Replies: 2 Views: 324 I am aware that I cut off the last bracket of the class, I just forgot to paste it. |
Forum: Java Feb 16th, 2009 |
| Replies: 2 Views: 324 I have two other classes but they are very small, and this is where the error lies. This is my code:
import java.util.Scanner;
public class Player
{
private boolean isHuman;
private int... |