You are assigned the task of creating a program for your


Salaries for a buisness

You are assigned the task of creating a program for your boss that will help him keep track of his employee's salaries and ensure that an employee is not entering their salary twice.  There are two types of employee's full time and part time.

Implement a superclass named Employee that contains a salary instance variable, a getSalary method, and a 1-parameter constructor. The getSalary method is a simple accessor method that returns the salary instance variable's value. The 1-parameter constructor receives a weeklywage parameter and assigns a value to the salary instance variable based on this formula:

            salary = weeklywage * 52;

Implement two classes named FullTime and PartTime; they are both derived from the Employee superclass. FullTime should contain a fullhours instance variable (the employees hours per week). PartTime should contain a parthours instance variable (the employees hours per week). The FullTime and PartTime classes should each contain a 2-parameter constructor, an equals method, and a display method. In the interest of elegance and maintainability, don't forget to have your subclass constructors call your superclass constructors when appropriate. The display method should print the values of all the instance variables within its class.

Provide a driver class that tests your three employee classes. Your driver class should contain this main method:

public static void main(String[] args)

{

  FullTime FullT1 = new FullTime(3000.00, 50);

  FullTime FullT2 = new FullTime(3000.00, 50);

  if (FullT1.equals(FullT2))

  {

            FullT1.display();

  }

  PartTime PartT1 = new PartTime(1500.00, 20);

  PartTime PartT2 = new PartTime(1500.00, 20);

  if (PartT1.equals(PartT2))

  {

            PartT1.display();

  }

} // end main

 

Output:

Full Time: Salary = $156000.00, Hours worked per week = 50

Part Time: Salary = $78000.00, Hours worked per week = 20

Solution Preview :

Prepared by a verified Expert
Chemistry: You are assigned the task of creating a program for your
Reference No:- TGS01291705

Now Priced at $30 (50% Discount)

Recommended (93%)

Rated (4.5/5)