Game of Guessing Numbers Java Program

$ 5

Game of Guessing Numbers Java Program

In a game of guessing numbers, one person says “I am thinking of a number between 1 and 100”. The second person guesses “50”. The first person says “No it is less”. The second person guesses “20”. The first person says “No it is greater”. This continues until the second person guesses the number. Write a program that plays this game. The computer knows the number (a random number between 1 and 100). The user (the second person) is the guesser. At the end of the program, the computer must displays the number of guesses it took the user to guess the number.
The program must include:
A main class
A loop (for, while or do-while)
An if or if – else statement
Must accept input from the keyboard
Must have a prompting statement
A separate class with a constructor
At least one method that performs an operation required by the main program

HERE IS AN ALGORITHM, PLEASE MAKE IT AS SIMPLE AS YOU CAN AND STILL INCLUDE THE NECESSARY RULES.
• Prompt
• Generate a random number (1-100)
Computer = gen random # (1-100)
Do (input number (kb Reader)
Stop = false;
{
If (myNum = computeNum
Stop = true
{
(System.out.println(“You win!”);
}
Else
If (myNum>computeNum)
{
System.out.println(“Your number is too high);
}
Else
If (myNum<computeNum)
{
System.out.println(“Your number is too low”);
}
}

99 in stock

SKU: JAVAGUESSING Category:

Description

Game of Guessing Numbers Java Program

In a game of guessing numbers, one person says “I am thinking of a number between 1 and 100”. The second person guesses “50”. The first person says “No it is less”. The second person guesses “20”. The first person says “No it is greater”. This continues until the second person guesses the number. Write a program that plays this game. The computer knows the number (a random number between 1 and 100). The user (the second person) is the guesser. At the end of the program, the computer must displays the number of guesses it took the user to guess the number.
The program must include:
A main class
A loop (for, while or do-while)
An if or if – else statement
Must accept input from the keyboard
Must have a prompting statement
A separate class with a constructor
At least one method that performs an operation required by the main program

HERE IS AN ALGORITHM, PLEASE MAKE IT AS SIMPLE AS YOU CAN AND STILL INCLUDE THE NECESSARY RULES.
• Prompt
• Generate a random number (1-100)
Computer = gen random # (1-100)
Do (input number (kb Reader)
Stop = false;
{
If (myNum = computeNum
Stop = true
{
(System.out.println(“You win!”);
}
Else
If (myNum>computeNum)
{
System.out.println(“Your number is too high);
}
Else
If (myNum{
System.out.println(“Your number is too low”);
}
}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.