Ask Java Expert


Home >> Java

The file must be called <Payroll.java> (driver program)

Employee.java

Hourly.java (which extends employee)

Salaried.java (which extends employee)

SalariedPlusCommission.java (which extends Salaried)

Ensure you include ALL files required to make your program compile and run.

I would like to see your .java files only.

Overall Requirements

Write an employee payroll program that uses polymorphism to calculate and print the weekly payroll for your company. There are three types of employees - hourly, salaried, and salaried plus commission. Each type of employee gets paid using a different formula. But for all employee types, if the calculated paycheck exceeds $1000, the actual paycheck must be decreased to $1000

Use this class hierarchy:

1221_Employee_payroll_program.jpg

Use the public access modifier for the toStringmethod in the Employee class and the load method in the Employee, Hourly, Salaried, and SalariedPlusCommission classes.

Employee.java class

Instance variables:

name

social security number

birthday month

birthday week

loadmethod :

Prompts the user for instance-variable values and loads the entries.

toStringmethod:

Returns a string that shows the employee's name, social security number, and paycheck.. Use the String.format method (See Java API documentation to help you format the string as shown in the sample session's paycheck report.) Here's an example from the sample session:

employee: Biff Sanchez

social security number: 111-11-1111

paycheck: $800.00

getBonusmethod:

Generates a $100 employee birthday bonus. Compare the employee's birthday with the current date found on your computer system. Use the Calendar class to generate the current date. (See Sun's Java API documentation.) If the employee's birthday month and birthday week match your computer system's current month and current week, then increment the employee's paycheck by $100. The birthdayMonth holds the month (1-12) in which the employee was born. The birthdayWeek holds the week (1-4) that the employee chooses to get paid his/her bonus.

Include a getEarningsmethod that is abstract.

Use the public access modifier for the toStringmethod to return a string version of the contents of the employee.

Hourly.java class

Instance variables:

hourly pay

hours worked during the past week

loadmethod:

Prompts the user for instance-variable values and loads the entries. Include a getEarningsmethod that calculates earnings for an hourly employee. Hourly employees are paid by the hour. If they work more than 40 hours in a week, then they receive overtime pay for their overtime work. Overtime pay equals one and a half times their normal hourly pay.

Salaried.java class

Instance variables:

Weekly salary

loadmethod:

Prompts the user for instance-variable values and loads the entries.

Include a getEarningsmethod that calculates earnings for a salaried employee. Salaried employees are paid their fixed weekly salary regardless of the number of hours they work.

SalariedPlusCommission.java class

Instance variables:

Sales during the past week commission rate

loadmethod:

Prompts the user for instance-variable values and loads the entries.

Include a getEarningsmethod that calculates earnings for a SalariedPlusCommission employee. SalariedPlusCommission employees are paid a base salary plus a percentage of their sales. "Percentage of their sales" equates to the product of their sales times their commission rate.

Use initially declared named constants instead of hardcoded "magic numbers" embedded in the program.

Provide a driver that generates the following queries and outputs.

Sample session (assuming current month = 10 and current week = 2):

Number of employees: 3

PROFILE FOR EMPLOYEE #1:

type Hourly(1), Salaried(2), Salaried plus Commission(3)

Enter 1, 2, or 3 ==>1

Name ==>Biff Sanchez

Social security number ==>111-11-1111

Birthday month (1-12) ==>2

Birthday bonus week (1-4) ==>3

Hourly pay ==>20

Hours worked this past week ==>30

PROFILE FOR EMPLOYEE #2:

type Hourly(1), Salaried(2), Salaried plus Commission(3)

Enter 1, 2, or 3 ==>2

Name ==>Dirk Jones

Social security number ==>222-22-2222

Birthday month (1-12) ==>10

Birthday bonus week (1-4) ==>2

Salary ==>700

PROFILE FOR EMPLOYEE #3:

type Hourly(1), Salaried(2), Salaried plus Commission(3)

Enter 1, 2, or 3 ==>3

Name ==>Suzie Que

Social security number ==>333-33-3333

Birthday month (1-12) ==>7

Birthday bonus week (1-4) ==>3

Salary ==>400

Sales for this past week ==>2000

Sales commission rate (fraction paid to employee) ==>.25

PAYCHECK REPORT:

employee: Biff Sanchez

social security number: 111-11-1111

paycheck: $600.00

employee: Dirk Jones

social security number: 222-22-2222

paycheck: $800.00

employee: Suzie Que

social security number: 333-33-3333

paycheck: $900.00

Java, Programming

  • Category:- Java
  • Reference No.:- M91411365
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As