Question: Write a method: that displays the prompt string, reads an integer, and tests whether it is between the minimum and maxi mum. If not, print

Write a method:

public static int readInt( Scanner in, String prompt, String error, int min,

that displays the prompt string, reads an integer, and tests whether it is between the minimum and maxi mum. If not, print an error message and repeat reading the input.
Add the method to a class Input.

••

public static int readInt( Scanner in, String prompt, String error, int min, int max)

Step by Step Solution

3.27 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

It seems you want to write a Java method within a class named Input ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!