I\'m in java one and need help with this code. please follow the directions give
ID: 3683318 • Letter: I
Question
I'm in java one and need help with this code. please follow the directions given and test your program to make sure it works as it is required. I will apreciate your help. thank you.please use the given code
Programming Concepts
1. Random Number Generation
Exercise Location
For this exercise, you will copy a program from my directory into yours. It doesn't matter what directory this exercise is located in. You will need to copy this command and paste it into Loki:please use the given code
cp ~lkoperski/1404_Lab/Exercises/Exercise10.java .
Exercise Description
^ You will create a game that has the user guess a number between 1 and 10.
^ Generate a random number that the user will attempt to guess.
^ If the user guesses a number that is lower than the answer, print a message that says that.
^ If the user guesses a number that is higher than the answer, print a message that says that.
^ If the user guesses a number that is equal to the answer, print a message that says that.
user@loki:~$ java Exercise10
I am thinking of a number between 1 and 10!
Enter a guess: 5
Too low!
Enter a guess: 8
Too high!
Enter a guess: 6
Too low!
Enter a guess: 7
You guessed it!
Comment
1 import java.util.Scanner; 2 import java.util.Random; 3 public class Exercise10 public static void main (String [] args 7 Scanner in = new Scanner(System.in); Random r = new Random(); 10 int guess = int answe r = // Create a random number between 1 and 10 System.out.println // While the guess doesn't equal the answer.. 12 13 I am thinking of a number between 1 and 10! 15 16 17 18 19 /Have the user enter a guess // If the guess is lower than the answer, print a message that s //...etc ays "Too low!" 20 21 23Explanation / Answer
Hi I will answer this by today. I will update my post soon.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.