Please check images for the rest of the question and provide code with comments and explanations. Thank you. Write a set of static methods, to make console input simpler. Consider that the only console input method using the Scanner class is inputString(), shown below; include it in your solution. This means you are not permitted to use the Scanner class in any of your methods. public static String inputString () { Scanner scan = new Scanner (System.in); // attach to console return ( scan.next() ); // return next string from input console stream } Example of calling and testing this method in your main(): String str = inputString(); // get input from console, assign to str displayln ("Input A is: " + str); // display input string displayln ("Input B is: " + inputString() ); // get input and d
Please check images for the rest of the question and provide code with comments and explanations.
Thank you.
Write a set of static methods, to make console input simpler.
Consider that the only console input method using the Scanner class is inputString(), shown below; include it in your solution. This means you are not permitted to use the Scanner class in any of your methods.
public static String inputString ()
{
Scanner scan = new Scanner (System.in); // attach to console
return ( scan.next() ); // return next string from input console stream
}
Example of calling and testing this method in your main():
String str = inputString(); // get input from console, assign to str
displayln ("Input A is: " + str); // display input string
displayln ("Input B is: " + inputString() ); // get input and display
Step by step
Solved in 3 steps with 1 images