Question: Add a getChoice() method to the Validation class: a. Signature of the class is: public static void getChoice(Scanner sc, String enterMsg, String vaildChoices) b. Where
Add a getChoice() method to the Validation class:
a. Signature of the class is: public static void getChoice(Scanner sc, String enterMsg, String vaildChoices)
b. Where the String parameter enterMsg is the user prompt - Ex: Continue (y/n): ?
c. Where the String parameter validChoices is a string that contains all of the valid letter choice answers for the prompt - Ex: YyNn
d. Use the String.contains() method to determine if the choice the user enters is valid: if(validChoices.contains(UserChoice)) isValid = true;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
