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
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...
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...
Write code in java using the LinkedList connecting two different classes. For example, Employee and EmployeeList...
Write code in java using the LinkedList connecting two different classes. For example, Employee and EmployeeList are two different classes that are used to create the assignment.
Case Study: A Tale of Two Classes Ebony Ellis has two communication classes back-to-back in the...
Case Study: A Tale of Two Classes Ebony Ellis has two communication classes back-to-back in the same room, but they couldn’t be more different. The first, a class on interpersonal communication, is taught by Steve Gardner, an older professor who has taught at the university for 20 years. The first day of class he verbally explained the rules for class conduct, which were also distributed in a printed handout—cell phones off, no texting, and, unless a student needs to use...
Two university graduates, Bill and Steve, worked for an advertising agency at an annual salary of...
Two university graduates, Bill and Steve, worked for an advertising agency at an annual salary of $40,000 each for 3 years after they graduated. Then, they decided to quit their jobs and start a partnership that designs and builds Web sites. They rented an office for $12,000 a year and bought capital for $30,000. To pay for the equipment, Bill and Steve borrowed money from a bank at an annual interest rate of 6 percent. During their first year of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT