Menu

[Solved]Create Program Consists Following Classes Abstract Class Employee1 Three Instance Variable Q37258783

Create a program that consists of the following classes:

  • Abstract class Employee1 that has
    • three instance variables of type String
      • FirstName
      • LastName
      • SocialSecurityNumber
    • set and get methods for each instance variable
    • a constructor that takes three string arguments to be assignedto the instance variables
    • a method toString that returns a string representation forvalues of the instance variables
    • an abstract method earnings that returns a double value

  • Class Employee2 that extends the abstract class Employee1 andhas:
    • an instance variable weeklySalary of type double
    • set and get methods for weeklySalary instance variable
    • a constructor that takes one double argument and three stringarguments to be assigned to the instance variables
    • an implementation of the abstract method earnings that has beeninherited from the class Employee1. The earnings method shouldcalculate the earning based on the weeklySalary.
    • a method toString that returns a string representation forvalues of the instance variables

  • Class Employee3 that extends the abstract class Employee1 andhas:
    • an instance variable grossSales of type double
    • an instance variable commissionRate of type double
    • set and get methods for grossSales and commissionRate instancevariables
    • a constructor that takes two double arguments and three stringarguments to be assigned to the instance variables
    • an implementation of the abstract method earnings that has beeninherited from the class Employee1. The earnings method shouldcalculate the earning based on commissionRate and grossSales.
    • a method toString that returns a string representation forvalues of the instance variables

  • Class Employee4 that extends the abstract class Employee1 andhas:
    • an instance variable wage of type double
    • an instance variable hours of type double
    • set and get methods for wage and hours instance variables
    • a constructor that takes two double arguments and three stringarguments to be assigned to the instance variables
    • an implementation of the abstract method earnings that has beeninherited from the class Employee1. The earnings method shouldcalculate the earning based on wage and hours.
    • a method toString that returns a string representation forvalues of the instance variables

  • Class Employee5 that extends class Emplyee3 which extends theabstract class Employee1 and has:
    • an instance variable baseSalary of type double
    • set and get methods for baseSalary instance variable
    • a constructor that takes three double arguments and threestring arguments to be assigned to the instance variables
    • an implementation of the abstract method earnings that has beeninherited from the class Employee1. The earnings method shouldcalculate the earning based on baseSalary and the two instancevariables that were inherited from Emplyee3 which arecommissionRate and grossSales.
    • a method toString that returns a string representation forvalues of the instance variables

  1. Create a classed called PayrollSystemTest to create an array oftype Employee1that consists of four elements that uses downcastingto refer to four different instantiated objects of type Employee2,Employee3, Employee4, Employee5. Polymorphically call earnings andtoString methods to display information about each object.

Expert Answer


Answer to Create a program that consists of the following classes: Abstract class Employee1 that has three instance variables of t… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *