Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are hired by a small company to design a payroll system to perform payroll calculations based on the type of employee (manager and hourly

image text in transcribed
image text in transcribed
You are hired by a small company to design a payroll system to perform payroll calculations based on the type of employee (manager and hourly worker). Managers are paid a fixed weekly salary regardless of the number of hours worked; hourly workers are paid by the the hours and receives overtime pay (50% more overtime pay, but overtime cannot exceed 20 hours per week). Both managers and hourly workers have something in common. For example, their names. However, the way each person's earnings are calculated depends on the type of employee, so you decided to define the common features in a more generic class named Employee, then create two subclasses, Manager and Hourly Worker for manager and hourly worker, respectively. Design an abstract class named Employee.java with the following data members and methods: Data members: firstName, lastName All getter and setter methods Constructor takes first name and last name as parameters. toString() methods to return name (Steve Davis, for example) earnings() to return earnings (double) (think about if it is appropriate to be defined as abstract) Create Manager.java and make it a subclass of Employee. This class should have its own data member: weeklySalary (double): Getter and setter method for the new data member Implement earnings() method to return weekly salary (be sure to validate weekly salary, the salary range 19 between 6800 and $2000, for any other numbers, assign o) Override toString() method to type of employee followed by manage name. For example, Manage: Steve Davis Create Hourlyworker.java and make it a subclass of Employee: Data members: wage (per hours), hours (hours worked for a week) Getter and setter methods (zemember, number of hours worked per week cannot exceed 60 hours. II a number over 60 19 entered, it will be reduced to 60 L wage range: $25 - $50, all other numbers are considered as invalid and assign default wage, which is $35 per hour) Implements earnings() method Override toString() to return employee type and name (for example, Hourly Worker: John Kanet) Write a tester class named Tester.java to test your payroll system. Your tester class will read data file (employee.txt) and create employee objects, then print payment for each employee. la: The la pat Steve Davis 1200 John Kanet 38.8 30 Matthew Williams 28 40 Alex Bovers 8000 *Atanas Radenski -45 a line starting with is a manager, followed by weekly salary: a line starting with worker, followed by ware and hours, is a hourly Sample outputs Manager Steve Davis Earned: 1200.0 Hourly worker John Kanet Earned 199 25 Hourly worker Katthew William Bannel 1000. Slana Saindo Bovers Beur Sind e r Atanas

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

=+How are processes modeled and what are process patterns?

Answered: 1 week ago

Question

Calculate a utility estimate for a target organization

Answered: 1 week ago