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

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!