Question: JAVA Please help quick! Write a method that Inputs 5 one-digit numbers from the user. Make sure to use clear prompts. Use word ENTER in
JAVA Please help quick!
Write a method that
- Inputs 5 one-digit numbers from the user.
- Make sure to use clear prompts. Use word ENTER in prompts to pass CodeGrade tests.
- Uses validation loops (or methods) so that the user cannot input anything other than one-digit number
- User must get error messages explaining why the value was rejected. All error messages must contain word ERROR in order to pass CodeGrade tests.
- The method calculates and prints out the largest of 5 integers provided by the user.
- See sample method calls below.
Method header: public static void problem02()
Add Java Doc comments before the method header.
This method is being tested automatically on CodeGrade with the help of regular expressions. Make sure to use the key words ENTER and ERROR in all caps as described above.
See sample method run below:
ENTER a one-digit number oops ERROR: Your input is not an integer. ENTER a one-digit number 876 ERROR: The number has more than one digit! ENTER a one-digit number 1 ENTER a one-digit number blah ERROR: Your input is not an integer. ENTER a one-digit number hehe ERROR: Your input is not an integer. ENTER a one-digit number 765 ERROR: The number has more than one digit! ENTER a one-digit number -9 ENTER a one-digit number 5 ENTER a one-digit number 2 ENTER a one-digit number 3 LARGEST = 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
