Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Method in Java. Keep the method type. UTF-8 /** * Prompts the user for an String value, displaying the following: * Enter the valName (min
Method in Java. Keep the method type. UTF-8
/** * Prompts the user for an String value, displaying the following: * "Enter the valName (min to max): " * Note: There should not be a new line terminating the prompt. valName should contain the * contents of the String referenced by the parameter valName. min and max should be the values * passed in the respective parameters. * * After prompting the user, the method will read an entire line of input, trimming any trailing * or leading whitespace. If the value read is (lexicographically ignoring case) between min and * max (inclusive), that value is returned. Otherwise, "Invalid value." terminated by a new line * is output and the user is prompted again. * * @param sc The Scanner instance to read from System.in. * @param valName The name of the value for which the user is prompted. * @param min The minimum acceptable String value (inclusive). * @param min The maximum acceptable String value (inclusive). * @return Returns the value read from the user. */ public static String promptStr(Scanner sc, String valName, String min, String max) { //FIXME return ""; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started