Question
Summary: For assignment one you will be implementing a payroll system that allows you: 1) Populate Employees a. You should populate one of each of
Summary:
For assignment one you will be implementing a payroll system that allows you:
1) Populate Employees
a.You should populate one of each of the following employees in your collection:
i.Hourly Employee
1. Prompt for Hours
2. Prompt for Rate
3. Make sure to calculate for overtime at time and a half
ii.Salary Employee
1. Prompt for Staff or Executive
2. Set Gross salary to $50,000 for staff and $100,000 for executives
iii.Commission Employee
1. Prompt for number of items sold
2. Prompt for unit price of item sold (we are selling widgets so just set a price of your choosing)
3. Commission Employees will get 50% of gross sales
2) Select Employee
a. Loop through your array and select the employee
b. Once the employee is selected you will get a menu inside of each Employee that allows you to select the following
i. Calculate Gross Pay
ii. Calculate Tax
iii. Calculate Net Pay
iv. Calculate Net Percent
v. Display Employee
3) Save Employees
a. Save the array or collection of Employees as a serialized object
b. Additionally you will save a file/report of each employee as a text file
4) Load Employee
a. You will load back in the serialized objects from the saved file
b. You should use a boolean variable that is set to true if you have loaded employees
i.This in turn would inform users and prevent them from populating employees if they select that option
Structure of Project:
- You are given the code below for your Employee Object.
- Each employee (Hourly, Salary, Commission) should inherit from Employee
- You will need to figure out which method from Employee that you should override in each subclass. ( It will only be one method)
- Payroll Class will have:
-Main method
-Menu method
-Populate Employees method
-Select Employee method
-Save Employee method
-Load Employee method
Employee Class will have:
-Code Given Below
EMPLOYEE CODE:
public class Employee
{
/*********************
Attributes
*********************/
float rate=30.0f;
float taxrate=0.2f;
int hours=45;
float gross=0.0f;
float tax=0.0f;
float net=0.0f;
float net_percent=0.0f;
//End Attributes
/********************
Constructors
********************/
public Employee()
{
}
/********************
Methods
********************/
public void menu()
{
}
public void computeGross()
{
gross=rate*hours;
}
protected void computeTax()
{
tax=gross*taxrate;
}
protected void computeNet()
{
net=gross-tax;
}
protected void computeNetperc()
{
net_percent=(net/gross)*100;
}
protected void displayEmployee()
{
System.out.println("Hours: " + new Integer(hours));
System.out.println("Rate: " + new Float(rate));
System.out.println("Gross: " + new Float(gross));
System.out.println("Net: " + new Float(net));
System.out.println("Net%: " + new Float(net_percent) + "%");
}
}
Payroll Employee Hourly Employee Salary Employee Commission EmployeeStep 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