
-----------------------------------
MingYang
Wed Dec 14, 2005 6:50 pm

tiny problem, come pros!!!
-----------------------------------
hi this programgenerates a random integer between 1 and 100. After each incorrect guess, the program should tell the user if they guessed too high or too low.

Here's the code, for some reason it only starts counting on the second input that user provide. Note: I have Int.java thingy so i dont need to write crazy code for Int.get etc.

/**
 * This program will allow the user to guess a number between 1
 * to 100, program will stop when the user guessed the correct number.
 * @Author: Ming Yang
 * @December 12, 2005
 */

class Number {  //setup the class name for the program
 public static void main(String[] args){    // the main method is always run first
   int number, number2, count;
   number = (int)(100 *Math.random ());
  
    System.out.print("Enter # from 1-100: \n");
    count = 0;
    number2 = In.getInt();
    while (number2 != number) {
    number2 = In.getInt();
 
    count = count + 1;
    System.out.print("\nYou have guessed " + count + " time(s). \n");
    
      if (number>number2) {
       System.out.print("THE NUMBER IS TOO LOW");
     }
       else if (numberguess) {
       System.out.print("THE NUMBER IS TOO LOW");
       }
       else if (numberguess) {
        System.out.print("THE NUMBER IS TOO LOW");
     }
     else if (number