Results 1 to 3 of 3
  1. #1
    CVanloon2 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default 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();
    }

  2. #2
    CVanloon2 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Re: Need some help witha profect ASAP please.

    nevermind, I figured it out. Using ORs instead of ANDs that is needed... ha

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default 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.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Please help me ASAP!
    By Asvin in forum New To Java
    Replies: 13
    Last Post: 05-17-2011, 06:55 PM
  2. Please need help asap
    By Tamtome in forum New To Java
    Replies: 9
    Last Post: 02-04-2011, 09:19 PM
  3. Need help ASAP, please
    By KAM0002 in forum New To Java
    Replies: 6
    Last Post: 12-08-2010, 05:58 PM
  4. Need help asap please!
    By mbm4ever in forum Java Applets
    Replies: 4
    Last Post: 08-12-2010, 04:57 PM
  5. Need some help ASAP
    By varma in forum New To Java
    Replies: 11
    Last Post: 01-08-2010, 01:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •