Home / Expert Answers / Computer Science / using-java-write-a-class-with-a-main-method-that-can-parse-input-from-the-user-and-construct-a-numbe-pa880

(Solved): Using Java Write a class with a main method that can parse input from the user and construct a numbe ...



Using Java Write a class with a main method that can parse input from the user and construct a number of Employees. Print each one you construct to the terminal.

Note that in some cases, there are errors in the input, your program needs to be able to handle this to still correctly construct the Employee. All 4 pieces of information needed (name, age, employer, and salary) will always be provided (and always in this order), you do not need error checking for incomplete data, only for the incorrect type of data. To be very clear: all 4 pieces of data needed to construct an Employee will ALWAYS be provided, but sometimes there is some junk input provided in between the key data elements.

In this question, you also need to be able to handle multiple lines of Employee input text per test case

Import any classes you need.

When incorrect input is present (see test cases #3) print the following warning messages as appropriate:

received int expecting String (for name, and employer)

received String expecting int (for age, and salary)

 



We have an Answer from Expert

View Expert Answer

Expert Answer


Solution:- Given data:- package cheg; import java.util.Scanner; public class ValidateInput { public static void main(String[] args) { Scanner sc=new S
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe