Java !! Overview In this task, you should start from the images GuessTheNumber.java output. The purpose is i.a. to learn how to use different control flow constructions and how we create random numbers within certain intervals by using the Math class. Task Based on the images GuessTheNumber output and extend its functionality as below: • The program should ask the user within which interval the random numbers should be. I.e. the program should ask for the minimum value and the maximum value the random number can be between (inclusive). It is ok to assume that no negative numbers are used and that the user first writes the lowest and then the highest. • If the user guesses a number that is outside the range, the program will print the valid range. • If the user guesses incorrectly, but within the range, the program should print if the guessed value is higher or lower than the hidden number. • If the user guesses correctly, the program should print out how many guesses were required. • If the user writes "exit" as his guess, the program must end. See the section Tips for task 2 regarding comparison of strings. Example run 1, 2 attached with the question
Java !!
Overview
In this task, you should start from the images GuessTheNumber.java output. The purpose is i.a. to learn how to use different control flow constructions and how we create random numbers within certain intervals by using the Math class.
Task
Based on the images GuessTheNumber output and extend its functionality as below:
• The program should ask the user within which interval the random numbers should be. I.e. the program should ask for the minimum value and the maximum value the random number can be between (inclusive). It is ok to assume that no negative numbers are used and that the user first writes the lowest and then the highest.
• If the user guesses a number that is outside the range, the program will print the valid range.
• If the user guesses incorrectly, but within the range, the program should print if the guessed value is higher or lower than the hidden number.
• If the user guesses correctly, the program should print out how many guesses were required.
• If the user writes "exit" as his guess, the program must end. See the section Tips for task 2 regarding comparison of strings.
Example run 1, 2 attached with the question
Step by step
Solved in 2 steps with 1 images