Please take look at this java code and help me complete this code to compile together. //MainValidatorA3 public class MainA3 { public static void main(String[] args) { System.out.println("Welcome to the Validation Tester application"); // Int Test System.out.println("Int Test"); ValidatorNumeric intValidator = new ValidatorNumeric("Enter an integer between -100 and 100: ", -100, 100); int num = intValidator.getIntWithinRange(); System.out.println("You entered: " + num + "\n"); // Double Test System.out.println("Double Test"); ValidatorNumeric doubleValidator = new ValidatorNumeric("Enter a double value: "); double dbl = doubleValidator.getDoubleWithinRange(); System.out.println("You entered: " + dbl + "\n"); // Required String Test System.out.println("Required String Test:"); ValidatorString stringValidator = new ValidatorString("Enter a required string: "); String requiredString = stringValidator.getRequiredString(); System.out.println("\nYou entered: " + requiredString + "\n"); // String Choice Test System.out.println("String Choice Test"); ValidatorString choiceValidator = new ValidatorString("Select one (x/y): ", "x", "y"); String choice = choiceValidator.getChoiceString(); System.out.println("You entered: " + choice); System.out.println("\nAll Done!"); } } // Validator.java import java.util.Scanner; public interface Validator { String getRequiredString(); String getChoiceString(); }
Please take look at this java code and help me complete this code to compile together.
//MainValidatorA3
public class MainA3 {
public static void main(String[] args) {
System.out.println("Welcome to the Validation Tester application");
// Int Test
System.out.println("Int Test");
ValidatorNumeric intValidator = new ValidatorNumeric("Enter an integer between -100 and 100: ", -100, 100);
int num = intValidator.getIntWithinRange();
System.out.println("You entered: " + num + "\n");
// Double Test
System.out.println("Double Test");
ValidatorNumeric doubleValidator = new ValidatorNumeric("Enter a double value: ");
double dbl = doubleValidator.getDoubleWithinRange();
System.out.println("You entered: " + dbl + "\n");
// Required String Test
System.out.println("Required String Test:");
ValidatorString stringValidator = new ValidatorString("Enter a required string: ");
String requiredString = stringValidator.getRequiredString();
System.out.println("\nYou entered: " + requiredString + "\n");
// String Choice Test
System.out.println("String Choice Test");
ValidatorString choiceValidator = new ValidatorString("Select one (x/y): ", "x", "y");
String choice = choiceValidator.getChoiceString();
System.out.println("You entered: " + choice);
System.out.println("\nAll Done!");
}
}
// Validator.java
import java.util.Scanner;
public interface Validator {
String getRequiredString();
String getChoiceString();
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images