Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Provided with the following Class information, I need to write a third class to

ID: 3539531 • Letter: P

Question

Provided with the following Class information, I need to write a third class to prompt the user with input questions to complete the form and with that information the program will output a collected statement with user provided information. I'm having a problem with directing user input data to the appropriate places.


Here is the provided Class code:


Person.java

public class Person
{
    protected String name;
   
    public Person()
        {
            name = "No Name Yet";
        }
           
        public Person(String initialName)
            {
                name = initialName;
            }
        public void setName(String newName)
            {
                name = newName;
            }
        public String getName()
            {
                return name;
            }
        public void writeOutput()
            {
                System.out.println("Name :" + name);
            }
       
       
        public boolean hasSameName(Person otherPerson)
            {
                return this.name.equalsIgnoreCase(otherPerson.name);
            }
}


Employee.java

public class Employee extends Person
    {
        private double annualSalary;
        private int hiredYear;
        private String ID;
       
        public Employee(String initialName, double initialSalary, int joinedYear, String id)
       
        {
            super(initialName);
            annualSalary = initialSalary;
            hiredYear = joinedYear;
            ID = id;
        }
       
        public void setAnnualSalary(double newSalary)
            {
                annualSalary = newSalary;
            }
        public void sethiredYear(int year)
            {
                hiredYear = year;
            }
        public void setID(String newID)
            {
                ID = newID;
            }
        public double getAnnualSalary()
            {
                return annualSalary;
            }
        public int getHiredYear()
            {
                return hiredYear;
            }
        public String getID()
            {
                return ID;
            }
       
        public boolean equals(Employee otherEmployee)
            {
                if (name.equals(otherEmployee.name))
                    if (annualSalary == otherEmployee.annualSalary)
                        if (hiredYear == otherEmployee.hiredYear)
                            if (ID == otherEmployee.ID)
                return true;
                return false;
            }   
           
        public void display()
            {
                System.out.println("Employee name: " + name);
                System.out.println("Employee Annual Salary: " + annualSalary);
                System.out.println("Employee Hired Year: " + hiredYear);
                System.out.println("Employee ID: " + ID);
                System.out.println();
            }
}


I have been asked to write a testClass that will output somthing in the following format for a minimum of 3 employees (prompt user initially for how many employees):


Employee name: xxxxx
Employee Annual Salary: xxxxx
Employee Hired Year: xxxxx
Employee ID: xxxxxxx

Explanation / Answer

Sample output



For how many employees You want to enter their details

5

Employee 1 Details

Enter employee name

Sun

Enter annual salary of the employee

5757

Enter hired year of the employee

1980

Enter the employee ID of the employee

65759

Employee 2 Details

Enter employee name

moon

Enter annual salary of the employee

77688

Enter hired year of the employee

1989

Enter the employee ID of the employee

78666666

Employee 3 Details

Enter employee name

jupiter

Enter annual salary of the employee

5600.00

Enter hired year of the employee

1980

Enter the employee ID of the employee

7897gf

Employee 4 Details

Enter employee name

saturn

Enter annual salary of the employee

7000

Enter hired year of the employee

1976

Enter the employee ID of the employee

68686

Employee 5 Details

Enter employee name

pluto

Enter annual salary of the employee

1975

Enter hired year of the employee

1980

Enter the employee ID of the employee

76887

Employee name: Sun

Employee Annual Salary: 5757.0

Employee Hired Year: 1980

Employee ID: 65759


Employee name: moon

Employee Annual Salary: 77688.0

Employee Hired Year: 1989

Employee ID: 78666666


Employee name: jupiter

Employee Annual Salary: 5600.0

Employee Hired Year: 1980

Employee ID: 7897gf


Employee name: saturn

Employee Annual Salary: 7000.0

Employee Hired Year: 1976

Employee ID: 68686


Employee name: pluto

Employee Annual Salary: 1975.0

Employee Hired Year: 1980

Employee ID: 76887

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote