Results 1 to 3 of 3
- 02-25-2013, 01:18 AM #1
Member
- Join Date
- Feb 2013
- Posts
- 2
- Rep Power
- 0
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, 02:07 AM #2
Member
- Join Date
- Feb 2013
- Posts
- 2
- Rep Power
- 0
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, 09:23 AM #3
Re: Need some help witha profect ASAP please.
Please go through the Forum Rules, particularly the second and third paragraphs.
I've deleted your other thread.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Please help me ASAP!
By Asvin in forum New To JavaReplies: 13Last Post: 05-17-2011, 05:55 PM -
Please need help asap
By Tamtome in forum New To JavaReplies: 9Last Post: 02-04-2011, 08:19 PM -
Need help ASAP, please
By KAM0002 in forum New To JavaReplies: 6Last Post: 12-08-2010, 04:58 PM -
Need help asap please!
By mbm4ever in forum Java AppletsReplies: 4Last Post: 08-12-2010, 03:57 PM -
Need some help ASAP
By varma in forum New To JavaReplies: 11Last Post: 01-08-2010, 12:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks