Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Input Validation 1 Objectives control structures console-based user input using Scanner class writing complete programs using two classes: client and supplier 2 User Interface Specification

Input Validation

1 Objectives

control structures

console-based user input using Scanner class

writing complete programs using two classes: client and supplier

2 User Interface Specification

This is a console-based I/O program. Display should go to System.out (print or println) and the program will get user input using the Scanner class. The flow of execution should be as follows:

When the program starts, display a one-line introduction to the user

Display a menu with 5 options

1. validate zip code

2. validate SSN

3. validate password

4. instructions

0. quit

Prompt the user to input an option

Prompt the user for the required input and then display the results

Repeat the main menu until the user enters the option to quit

If the user enters an invalid menu option, print a helpful error message and re-prompt. Note, this could be either a wrong value or wrong data type.

3 Specifications

two different classes. separate the user interface code from the code that performs validation.

In a supplier class named Validations, implement 3 static methods to perform these different validation tasks:

validate that a String represents a valid zip code. A valid zip code is made up of 5 digits.

validate that a String represents a 9-digit SSN. A valid SSN follows the pattern XXX-XX-XXXX, including the dashes.

validate that a String represents 8 symbols, including letters (upper and lower case), numbers, and special symbols like #$&_.

this Validations class does not need a 'main' method. However, you may write one for testing purposes if you wish. You must use parameter lists and return statements to move data in and out of these methods. No method in this class should use System.out.println or the Scanner class (except an optional test method). In other words, no method here should interact with the user; that's the job of the other class.

In a class named ValidateApp, create a console-based, menu-driven user interface that behaves like the one described above. This class must use a 'main' method to start things off. However, you are encouraged to decompose your solution to organize your code.

No class variables may be used; class constants are ok.

Your program should not throw any exceptions to the user. If a user enters an invalid menu option, the program should display a helpful error message and ask for new input.

implement solution using loops, if statements, and switch-case.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

2. The model is credible to the trainees.

Answered: 1 week ago