Question: ) Write a java program that has a superclass called Employee with: a) Three private data members name of type String. hourRate of type double,
) Write a java program that has a superclass called Employee with: a) Three private data members name of type String. hourRate of type double, and working Hours of type integer b) One Constructor that take string, double and integer parameters to set employee name, hourRate and working Hours c One method calculateSalary that will calculate and retum the salary of the employee using the equation salary workingHours hourRate Have one subclass called Manager with a) Private data member, deptCode of type int b) One constructor that take two parameters String and integer to set the employee name and the deptCode c) Set and get methods for the deptCode d) Override the calculate Salary by adding 500 to the salary if the deptCode is 3. Test your code using main by: a) Create one object from the superclass with employee name "Sam", hourRate-20, and workingHours -30 b) Create one object from the subclass with employee name "Sarah" and deptCode 2, hourRate-30, c) Create one object from the subclass with emp loyee name "Adam" and deptCode 3, hourRate 40 then printout the salary for Sam workingHours -35 then printout the deptCode and the salary for Sarah workingHours -40 then printout the deptCode and the salary for Adam
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
