# Need some help witha profect ASAP please.

• 02-25-2013, 02:18 AM
CVanloon2
Need some help witha profect ASAP please.
So these are the steps for the project I am working on
1. ask the user for the number of sides on the die and read that value forcing a
correct input of 2, 4, or 6;
2. ask the user for a value to watch for. That value should be from 1 to the
number of sides on the die. Correct input should be forced.
3. ask the user how long a continuous string of values requested in 2. above to
look for; (Remember, the higher this number, the more throws it will take to
find the string. For example, it will take, on average, more throws before 7
fives come up than it will to find 5 fives.)
4. ask the user how many times to run the experiment; (This should be a
number greater than or equal to 1.
5. run the experiment the number of times determined in 4. above, adding the
number of throws required to find the string of values of the specified length;
6. compute and print the average of the experimental results. (This would just
be the sum found in 5. divided by the number of times to run the experiment
obtained in 4.
7. ask the user if another run is desired and force yes or no ignoring case. If yes,
start again at 1.; otherwise, the program ends.

I have ran into a problem validating information.
I have this code but it is giving me invalid input everytime no matter what i put in...

System.out.print("Please enter the number of sides on the die (enter"
+ " 2, 4, or 6): ");
numSides = keyboard.nextInt();

while (numSides != 2 || numSides != 4 || numSides != 6) {
System.out.print("Incorrect input.\nPlease re-enter the number of "
+ "sides on the die (enter 2, 4, or 6): ");
numSides = keyboard.nextInt();
}
• 02-25-2013, 03:07 AM
CVanloon2
Re: Need some help witha profect ASAP please.
nevermind, I figured it out. Using ORs instead of ANDs that is needed... ha
• 02-25-2013, 10:23 AM
DarrylBurke
Re: Need some help witha profect ASAP please.
Please go through the Forum Rules, particularly the second and third paragraphs.