بليز عندي هذا السؤال اذ حد يعرف يحله (جافا 2009)اريده يوم السبت اذ حد يعرفله
Programming question
Play a guessing game with the computer. It chooses a number between 1 and 100 (inclusive), and the
user has to guess that number. The computer will tell the user if the guess was right, too high or too low.
The game continues until the user guesses the correct value, after which the user is told how many
guesses they made.
Algorithm:
1. Generate a random number between 1 and 100 (inclusive)
2. Get a guess from the user
3. Increase the guess counter by 1
4. If the guess is too high, print out "Too high" or else if the guess is too low, print out "Too low"; repeat
steps 2, 3 and 4 until guess equals random number
5. Print out "Correct, you took x guesses"
Write the Java code to implement the above and attach the printed code to your submission.
ولكم مني جزيل الشكر
Programming question
Play a guessing game with the computer. It chooses a number between 1 and 100 (inclusive), and the
user has to guess that number. The computer will tell the user if the guess was right, too high or too low.
The game continues until the user guesses the correct value, after which the user is told how many
guesses they made.
Algorithm:
1. Generate a random number between 1 and 100 (inclusive)
2. Get a guess from the user
3. Increase the guess counter by 1
4. If the guess is too high, print out "Too high" or else if the guess is too low, print out "Too low"; repeat
steps 2, 3 and 4 until guess equals random number
5. Print out "Correct, you took x guesses"
Write the Java code to implement the above and attach the printed code to your submission.
ولكم مني جزيل الشكر
تعليق