Question

In: Computer Science

Design two sub- classes of Employee...SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute....

Design two sub- classes of Employee...SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute. An hourly employee has an hourly pay rate attribute, an hours worked attribute, and an earnings attribute. An hourly employee that works more than 40 hours gets paid at 1.5 times their hourly pay rate. You will decide how to implement constructors, getters, setters, and any other methods that might be necessary.

1. (20 points) Draw a UML diagram for the classes.

2. (80 points) Implement the classes, and write a test program that creates a salaried employee and two hourly employees. One of the hourly employees should have hours worked set to less than 40 and one should have hours worked set to more than 40.

The test program should display all attributes for the three employees. To keep things simple, the employee classes don’t need to do any editing.

I really need help with the first part of this question regarding the UML.

Solutions

Expert Solution

Notes:

  • Employee Class details are not provided in the question description. Hence, the details are assumed for the sake of convenient understanding and used in the UML Diagram. Please, feel free to change as per the intended needs.

Please find the UML Diagram as per the requirement:

Employee Class:

  • Employee is the parent class as understood from the question.
  • The variables and methods are assumed as details were not given in question.

HourlyEmployee Class:

  • HourlyEmployee is the sub class.
  • Hourly_Payrate is the variable to store hourly payrate.
  • Hours_Worked is the variable to store number of hours worked.
  • Earnings is the variable to store the gross earnings.
  • SetHours() is the setter method to set Hourly_Payrate and Hours_Worked.
  • GetEarnings() is the getter method to get gross earnings. This method calculates the earnings based on the number of hours worked. If >40 hours, then 1.5 times the hourly payrate.

SalariedEmployee Class:

  • AnnualSalary is the variable to store the salary of the employee.
  • Earnings is the variable to store the gross earnings.
  • SetAnnualSalary() is the setter method to set annual salary for the employee.
  • GetEarnings() is the getter method to get gross earnings.

Thank you!!!


Related Solutions

Design two sub- classes of Employee...SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute....
Design two sub- classes of Employee...SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute. An hourly employee has an hourly pay rate attribute, an hours worked attribute, and an earnings attribute. An hourly employee that works more than 40 hours gets paid at 1.5 times their hourly pay rate. You will decide how to implement constructors, getters, setters, and any other methods that might be necessary. 1. 2. (20 points) Draw a UML diagram for the classes. (80...
Aimee is a salaried nonexempt employee who earns an annual salary of $54,000 for a 35-hour...
Aimee is a salaried nonexempt employee who earns an annual salary of $54,000 for a 35-hour workweek, paid biweekly. The employer pays overtime for any hours worked in excess of 35 per week. During a pay period, she worked 73.5 hours. She has requested that she take compensatory time in lieu of paid overtime. How much compensatory time should she receive, assuming that her firm approves the compensatory time? 3.5 hours 2.75 hours 5.25 hours 10.25 hours
JAVA Design a class named Person and its two derived classes named Student and Employee. Make...
JAVA Design a class named Person and its two derived classes named Student and Employee. Make Faculty and Staff derived classes of Employee. A person has a name, address, phone number, and e-mail address. A student has a class status (freshman, sophomore, junior, or senior). An employee has an office, salary, and datehired. Define a class named MyDate that contains the fields year, month, and day. A faculty member has office hours and a rank. A staff member has a...
Joey receives two job offers: Job A has a starting annual salary of $80,000 and an...
Joey receives two job offers: Job A has a starting annual salary of $80,000 and an expected annual salary growth of 7%. Job B has a starting annual salary of $100,000 and an expected salary growth of 5%. Joey is 30 years old and plans to retire when he turns 65. Ignore bonuses, pensions, other compensations and taxes; all cash flows will be made at the end of each year. Joey discounts future cash flows at an effective annual rate...
Create a class called employee which has the following instance variables: Employee ID number Salary Years...
Create a class called employee which has the following instance variables: Employee ID number Salary Years at the company Your class should have the following methods: New employee which reads in an employee’s ID number, salary and years of service Anniversary which will up the years of service by 1 You got a raise which will read in how much the raise was (a percent) and then calculate the new salary You get a bonus which gives a yearly bonus...
The answer should be in JAVA. You will design and implement two classes to support a...
The answer should be in JAVA. You will design and implement two classes to support a client program, RockPaperScissorsGame.java, to simulate Rock-Paper-Scissors game. Read and understand the client program to find out the requirements for the HandShape and Player classes. The rules of the Rock-Paper-Scissors game are:     Scissors✌️ beats Paper✋ that beats Rock✊ that beats Scissors✌️ Additionally, to simplify the game logic (and complexify a little bit the HandSahpe class) , two players cannot show the same hand shape....
The answer should be in JAVA. You will design and implement two classes to support a...
The answer should be in JAVA. You will design and implement two classes to support a client program, RockPaperScissorsGame.java, to simulate Rock-Paper-Scissors game. Read and understand the client program to find out the requirements for the HandShape and Player classes. The rules of the Rock-Paper-Scissors game are:     Scissors✌️ beats Paper✋ that beats Rock✊ that beats Scissors✌️ Additionally, to simplify the game logic (and complexify a little bit the HandSahpe class) , two players cannot show the same hand shape....
Write a C++ program to allow the user to: 1. Create two classes. Employee and Departments....
Write a C++ program to allow the user to: 1. Create two classes. Employee and Departments. The Department class will have: DepartmentID, Departmentname, DepartmentHeadName. The Employee class will have employeeID, emploeename, employeesalary, employeeage, employeeDepartmentID. Both of the above classes should have appropriate constructors, accessor methods. 2. Create two arrays . One for Employee with the size 5 and another one for Department with the size 3. Your program should display a menu for the user to do the following: 1....
The annual salary of teachers in a certain state has a mean of μ = $...
The annual salary of teachers in a certain state has a mean of μ = $ 54,000 and standard deviation of σ = $ 5,000 . What is the probability that the mean annual salary of a random sample of 5 teachers from this state is more than $60,000?
A) Maria is single with no dependents and has an annual salary of $125,000. She is...
A) Maria is single with no dependents and has an annual salary of $125,000. She is considering the purchase of a $400,000 house. While she was house-hunting, the 2017 tax act passed, changing the deductions and tax brackets and limiting the deduction for state and local taxes (SALT) to $10,000. Prior to 2018, the standard deduction for a single person was $6,350 and a person exemption of $4,050. A portion of the taxable income-brackets was: Over But Not Over Percentage...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT