Question

readString (String prompt): A method with this name should display the given prompt, and return aString. bu could use a method like this to ask the user for any kind

of string value. • readInt (String prompt): A method with this name should display the given prompt, and return aninteger. - You could use a method like this to ask the user for any integer value. • readChoice (String[] options): A method with this name should display each of the given options,and return an integer corresponding to the index of one of the options. - You could use a method like this as the main "menu" for the HospitalSystem, displaying all theoptions, and returning in integer. • outputString(String outString): A method to show the given string to the user.- You could use a method like this to display the state of the Hospital, or report a user input error. This interface is not useful because it is some kind of universal tool. It is useful because it generalizesinteraction between an application and a user, which can be implemented in different ways. Each imple-mentation could be different, but the application could still use it because it conforms to the standard.In this question, we will implement these methods for use with the console. That will require writing a classcalled ConsoleI0 that implements this interface. There should be one attribute, the scanner used by the methods. • The methods in ConsoleI0 will use System.in (with the Scanner, of course) and System.out to interactwith the user. • Your methods can check for validity of user input, but should not throw any exceptions if the usertypes something invalid. If the user's input was invalid, your method should deal with the problembefore returning. You should test your implementation of ConsoleI0. In ConsoleI0.main(), make sure that you use all 4 ofthe methods. Running main() will require you to enter data from the console, so the testing will not be asautomated as sonme other classes could be • main() will call the input methods, and it reauire you to type some input values. • To checkif the inputmethods are working, you'lldisplay the input values on the console using outputString(),and use a visual check. Then we have to go through the HospitalSystem, and re-write those places where the code uses a Scannerdirectly, or uses System.out directly, replacing them with appropriate calls to the ConsoleI0 methods.All console input/output in the HospitalSystem must be done through ConsoleI0.Benefits: The HospitalSystem Code will be tidier. All the user-input input can be checked ina standard uniform way, and all in the same class! • Once converted to use cConsoleI0, we can replace it with another class that also implementsInputOutputInterface but uses a GUI, and we will not have to change HospitalSystematall, becauseit was programmed to work with an interface, and not with a specific class.

Question image 1Question image 2Question image 3Question image 4Question image 5Question image 6Question image 7Question image 8Question image 9Question image 10Question image 11Question image 12Question image 13Question image 14Question image 15Question image 16Question image 17Question image 18