Question: Language: JAVA Data/Input) Validation: Often the validation code has been duplicated. This time we have a requirement to try and stay as DRY as possible.

Language: JAVA

Data/Input) Validation:

Often the validation code has been duplicated. This time we have a requirement to try and stay as DRY

as possible. Thus, you will need to create a class called Validator which implements an interface as follows:

o The interface is called Acceptable you must create this interface and include it as part of your code. The interface will have the methods:

boolean isNonEmptyString (String s);

boolean isPositiveInput (double d);

o Your Validator class will implement this interface and define the methods to perform these checks.

o Your code will use your validator to do all the input validation such that the appropriate methods can simply be called and all the duplicated code will reside in the Validator class.

How can I create this. ( creating an online store and the input has to be positive and nonempty)

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!