Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Company Bookkeeping A company employs and pays 4 types of employees ( each with its own job code ) : Hourly. Each hourly employee has

Company Bookkeeping
A company employs and pays 4 types of employees (each with its own job code):
Hourly. Each hourly employee has an hourly wage and is paid weekly. If an employee works 40 hours or less in a
week, then the employees pay is the product of the number of hours worked and the hourly wage. If an employee
works more than 40 hours in a week, then the employee is paid the hourly wage for the first 40 hours of work and
1.5 times the hourly rate for the hours worked in excess of 40. The code for this job type is HRLY.
Salaried. A salaried employee is paid the same amount each week. The code for this job type is SLRY.
Commission. The pay for employees that work on commission is a percentage of their weekly sales. The code for
this job type is COMM.
Limited Commission. A limited commission employee is paid similarly to a commission employee except that a
limited commission employee is guaranteed a minimum amount, his or her base pay, but commission pay is
limited to no more than twice the base pay. The code for this job is type LCOM.
The above pay descriptions do not include bonuses. Employees may also earn bonuses that are in addition to the pay the
earn as described above. Each week, any bonus that an employee has earned is added to the pay that is calculated by job
type.
The company also pays for utilities such as electricity, internet, telephone, and water. The amount of a utility bill is the
sum of two parts. The first part is calculated based on the usage of the utility by the company. This part is calculated as
the product of the amount of the utility used by the company for the week and the billing rate for the utility. The second
part is a base fee that is charged each week regardless of the amount of the utility that is used.
Programming the Bookkeeping
Create a Java program that handles some bookkeeping tasks for the company by defining the following interfaces and
classes. Your program must implement the UML class diagram that is at the end of this assignment description and as
described below.
1. The PayableEntity interface requires its implementors to define an amountOwed method that takes no arguments
and returns a double value.
2. The Employee abstract class implements the PayableEntity interface. It represents employees of all types. It has a
static numEmployees variable to count each Employee instance as it is created. It has non-static name and bonus
instance variables to represent an employees name and bonus amount. The class has the following methods.
A constructor that takes the employees name as an argument and increments the employee count.
An abstract calcPrebonusPay method for calculating an employees without including any bonus.
An abstract getJobCode method that returns a four-character string representing the employees job type.
A static getNumEmployees method that returns the number of Employee instances that have been created.
A calcTotalPay method that calls the calcPrebonusPay method and adds the employees bonus to the
result.
An amountOwed method that returns the result of calling the calcTotalPay method.
Two getters: getName and getBonus; and one setter: setBonus
A toString method that returns a string containing the instances name, job code, pre-bonus pay, and total pay
formatted as follows. A minimum of 15 characters is dedicated to the employees name which is left justified. This
is followed by a single space and then the employees 4-character job code. This is followed by a single space and
a dollar sign. After the dollar sign a minimum of 8 characters is dedicated to the employees pre-bonus pay which
includes a decimal point and two digits after the decimal point. Following that is a space, a dollar sign and then at
least 8 characters for the employees total pay including a decimal point and two following digits. Both pre-bonus
pay and total pay are right justified. (See Figure 1). Use String.format to generate the string. Use only space
characters for spacing. Do not include leading or trailing whitespace (space, tab, new line, etc.) in the string.
Figure 1. Example of the form of a string returned by the toString method of the Employee class
3. The HourlyEmployee class is a subclass of the Employee class. It has instance variables for the hourly employees
hourly wage and hours worked. In addition to having concrete definitions for calcPrebonusPay and getJobCode,
this class has the following methods.
A constructor that takes the hourly employees name and hourly wage as arguments. The constructor should call
the Employee constructor so that the hourly employee is counted.
A setHoursWorked method that takes as its only argument the number of hours worked by the employee
4. The SalariedEmployee class is a subclass of the Employee class. It has instance variables for the salaried
employees weekly pay. In addition to having concrete definitions for the calcPrebonusPay and getJobCode, this
class has the following method.
A

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_2

Step: 3

blur-text-image_3

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 Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago