Answered step by step
Verified Expert Solution
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 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 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 hours in a week, then the employee is paid the hourly wage for the first hours of work and
times the hourly rate for the hours worked in excess of 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.
The PayableEntity interface requires its implementors to define an amountOwed method that takes no arguments
and returns a double value.
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 nonstatic 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 fourcharacter 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, prebonus pay, and total pay
formatted as follows. A minimum of characters is dedicated to the employees name which is left justified. This
is followed by a single space and then the employees character job code. This is followed by a single space and
a dollar sign. After the dollar sign a minimum of characters is dedicated to the employees prebonus 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 characters for the employees total pay including a decimal point and two following digits. Both prebonus
pay and total pay are right justified. See Figure 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 Example of the form of a string returned by the toString method of the Employee class
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started