Placeholder

CSIS 312 Assignment 3 Payroll System

$9.99

Description

Modify the payroll system of Figs. 10.4–10.9 to include an additional Employee subclass PieceWorker that represents an employee whose pay is based on the number of pieces of merchandise produced.
Class PieceWorker should contain private instance variables wage (to store the employee’s wage per piece) and pieces (to store the number of pieces produced).
Provide a concrete implementation of method earnings in class PieceWorker that calculates the employee’s earnings by multiplying the number of pieces produced by the wage per piece.
Create an array of Employee variables to store references to objects of each concrete class in the new Employee hierarchy (SalariedEmployee, CommissionEmployee, HourlyEmployee, BasePlusCommissionEmployee, and now PieceWorker).
For each Employee, display its String representation and earnings.
Submit this assignment by 11:59 p.m. (ET) on Monday of Module/Week 3.
SCREENSHOTS
SOLUTION
PAYMENT
CSIS312 – ADVANCED OBJECT-ORIENTED PROGRAMMING Assignment 3
CSIS312 – ADVANCED OBJECT-ORIENTED PROGRAMMING Assignment 3
CSIS312 Assignment 3
CSIS312 Week 3
The solution consists of:
A report word document for this assignment
All Java programs and classes
A Netbeans project in case you want to run the project on your computer.
Screenshots showing program running
Attachments [Move over files to preview content of those files]
CSIS_312_Assignment_3.zip (311.92 KB)
classes
BasePlusCommissionEmployee.class
CommissionEmployee.class
Employee.class
HourlyEmployee.class
PayrollSystemTest.class
PieceWorker.class
SalariedEmployee.class
CSIS312 Assignment 3 Report.docx
Netbeans project
CSIS312Assignment3
pom.xml
src
main
java
BasePlusCommissionEmployee.java
CommissionEmployee.java
Employee.java
HourlyEmployee.java
PayrollSystemTest.java
PieceWorker.java
SalariedEmployee.java
target
classes
.netbeans_automatic_build
BasePlusCommissionEmployee.class
CommissionEmployee.class
Employee.class
HourlyEmployee.class
PayrollSystemTest.class
PieceWorker.class
SalariedEmployee.class
generated-sources
annotations
maven-status
maven-compiler-plugin
compile
default-compile
createdFiles.lst
inputFiles.lst
test-classes
.netbeans_automatic_build
screenshots
CSIS 312 Assignment 3 Screenshot 1.jpg
CSIS 312 Assignment 3 Screenshot 2.jpg
source code
BasePlusCommissionEmployee.java
CommissionEmployee.java
Employee.java
HourlyEmployee.java
PayrollSystemTest.java
PieceWorker.java
SalariedEmployee.java
Preview BasePlusCommissionEmployee.java
xxxxxx xxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx)
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx,
xxxxxxxxxx, xxxxxxxxxxxxxx);
if (baseSalary < 0.0) // validate baseSalary throw new IllegalArgumentException("Base salary must be >= 0.0″);
this.baseSalary = baseSalary; }
// set base salary public void setBaseSalary(double baseSalary) { if (baseSalary < 0.0) // validate baseSalary throw new IllegalArgumentException("Base salary must be >= 0.0″);
xxxx.xxxxxxxxxx = xxxxxxxxxx;
}
// xxxxxx xxxx xxxxxx
xxxxxx xxxxxx xxxxxxxxxxxxx()
{
Preview CommissionEmployee.java
xxxxxx xxxxxxxxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx,
xxxxxx xxxxxxxxxxxxxx)
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx);
if (commissionRate <= 0.0 || commissionRate >= 1.0) // validate throw new IllegalArgumentException( “Commission rate must be > 0.0 and < 1.0"); if (grossSales < 0.0) // validate throw new IllegalArgumentException("Gross sales must be >= 0.0″);
this.grossSales = grossSales; this.commissionRate = commissionRate; }
// set gross sales amount
xxxxxx xxxx xxxxxxxxxxxxx(xxxxxx xxxxxxxxxx)
{
xx (xxxxxxxxxx < 0.0) // xxxxxxxx xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx("xxxxx xxxxx xxxx xx >= 0.0″);
xxxx.xxxxxxxxxx = xxxxxxxxxx;
Preview Employee.java
xxxxxx xxxxxxxx(xxxxxx xxxxxxxxx, xxxxxx xxxxxxxx,
xxxxxx xxxxxxxxxxxxxxxxxxxx)
{
xxxx.xxxxxxxxx = xxxxxxxxx;
xxxx.xxxxxxxx = xxxxxxxx;
this.socialSecurityNumber = socialSecurityNumber; }
// return first name public String getFirstName() { return firstName; }
// return last name public String getLastName() {
xxxxxx xxxxxxxx;
}
// xxxxxx xxxxxx xxxxxxxx xxxxxx
xxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxx()
{
Preview HourlyEmployee.java
xxxxxx xxxxxxxxxxxxxxxxxxxx, xxxxxx xxxx, xxxxxx xxxxx)
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx);
xx (xxxx < 0.0) // xxxxxxxx xxxx throw new IllegalArgumentException( "Hourly wage must be >= 0.0″);
if ((hours < 0.0) || (hours > 168.0)) // validate hours throw new IllegalArgumentException( “Hours worked must be >= 0.0 and <= 168.0"); this.wage = wage; this.hours = hours; } // set wage xxxxxx xxxx xxxxxxx(xxxxxx xxxx) { xx (xxxx < 0.0) // xxxxxxxx xxxx xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx( "xxxxxx xxxx xxxx xx >= 0.0″);
Preview PayrollSystemTest.java
xxxxxxxxxxxxxx xxxxxxxxxxxxxx =
xxx xxxxxxxxxxxxxx(“xxxxx”, “xxxxx”, “222-22-2222”, 16.75, 40);
xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx =
xxx xxxxxxxxxxxxxxxxxx(
“xxx”, “xxxxx”, “333-33-3333”, 10000, .06);
BasePlusCommissionEmployee basePlusCommissionEmployee = new BasePlusCommissionEmployee( “Bob”, “Lewis”, “444-44-4444”, 5000, .04, 300);
PieceWorker pieceWorker = new PieceWorker(“Jacques”, “Brode”, “555-55-5555”, 20, 44);
System.out.println(“Employees processed individually:”);
System.out.printf(“%n%s%n%s: $%,.2f%n%n”, salariedEmployee, “earned”, salariedEmployee.earnings()); System.out.printf(“%s%n%s: $%,.2f%n%n”, hourlyEmployee, “earned”, hourlyEmployee.earnings());
xxxxxx.xxx.xxxxxx(“%x%x%x: $%,.2x%x%x”,
xxxxxxxxxxxxxxxxxx, “xxxxxx”, xxxxxxxxxxxxxxxxxx.xxxxxxxx());
xxxxxx.xxx.xxxxxx(“%x%x%x: $%,.2x%x%x”,
xxxxxxxxxxxxxxxxxxxxxxxxxx,
“xxxxxx”, xxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxx());
xxxxxx.xxx.xxxxxx(“%x%x%x: $%,.2x%x%x”,
Preview PieceWorker.java
}
// xxx xxxxxxxx�x xxxx
xxxxxx xxxxxx xxxxxxx() {
xxxxxx xxxx;
}
// set employee�s wage public void setWage(double wage) { this.wage = wage; }
// get number of pieces produced public int getPieces() { return pieces; }
// xxx xxxxxx xx xxxxxx xxxxxxxx
xxxxxx xxxx xxxxxxxxx(xxx xxxxxx) {
xxxx.xxxxxx = xxxxxx;
}
// xxxxxxxxxx xxx xxxxxxxx’x xxxxxxxx
Preview SalariedEmployee.java
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx);
xx (xxxxxxxxxxxx < 0.0) xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx( "Weekly salary must be >= 0.0″);
this.weeklySalary = weeklySalary; }
// set salary public void setWeeklySalary(double weeklySalary) { if (weeklySalary < 0.0) throw new IllegalArgumentException( "Weekly salary must be >= 0.0″);
xxxx.xxxxxxxxxxxx = xxxxxxxxxxxx;
}
// xxxxxx xxxxxx
xxxxxx xxxxxx xxxxxxxxxxxxxxx()
{
Preview BasePlusCommissionEmployee.java
xxxxxx xxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx)
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx,
xxxxxxxxxx, xxxxxxxxxxxxxx);
if (baseSalary < 0.0) // validate baseSalary throw new IllegalArgumentException("Base salary must be >= 0.0″);
this.baseSalary = baseSalary; }
// set base salary public void setBaseSalary(double baseSalary) { if (baseSalary < 0.0) // validate baseSalary throw new IllegalArgumentException("Base salary must be >= 0.0″);
xxxx.xxxxxxxxxx = xxxxxxxxxx;
}
// xxxxxx xxxx xxxxxx
xxxxxx xxxxxx xxxxxxxxxxxxx()
{
Preview CommissionEmployee.java
xxxxxx xxxxxxxxxxxxxxxxxxxx, xxxxxx xxxxxxxxxx,
xxxxxx xxxxxxxxxxxxxx)
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx);
if (commissionRate <= 0.0 || commissionRate >= 1.0) // validate throw new IllegalArgumentException( “Commission rate must be > 0.0 and < 1.0"); if (grossSales < 0.0) // validate throw new IllegalArgumentException("Gross sales must be >= 0.0″);
this.grossSales = grossSales; this.commissionRate = commissionRate; }
// set gross sales amount
xxxxxx xxxx xxxxxxxxxxxxx(xxxxxx xxxxxxxxxx)
{
xx (xxxxxxxxxx < 0.0) // xxxxxxxx xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx("xxxxx xxxxx xxxx xx >= 0.0″);
xxxx.xxxxxxxxxx = xxxxxxxxxx;
Preview Employee.java
xxxxxx xxxxxxxx(xxxxxx xxxxxxxxx, xxxxxx xxxxxxxx,
xxxxxx xxxxxxxxxxxxxxxxxxxx)
{
xxxx.xxxxxxxxx = xxxxxxxxx;
xxxx.xxxxxxxx = xxxxxxxx;
this.socialSecurityNumber = socialSecurityNumber; }
// return first name public String getFirstName() { return firstName; }
// return last name public String getLastName() {
xxxxxx xxxxxxxx;
}
// xxxxxx xxxxxx xxxxxxxx xxxxxx
xxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxx()
{
Preview HourlyEmployee.java
xxxxxx xxxxxxxxxxxxxxxxxxxx, xxxxxx xxxx, xxxxxx xxxxx)
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx);
xx (xxxx < 0.0) // xxxxxxxx xxxx throw new IllegalArgumentException( "Hourly wage must be >= 0.0″);
if ((hours < 0.0) || (hours > 168.0)) // validate hours throw new IllegalArgumentException( “Hours worked must be >= 0.0 and <= 168.0"); this.wage = wage; this.hours = hours; } // set wage xxxxxx xxxx xxxxxxx(xxxxxx xxxx) { xx (xxxx < 0.0) // xxxxxxxx xxxx xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx( "xxxxxx xxxx xxxx xx >= 0.0″);
Preview PayrollSystemTest.java
xxxxxxxxxxxxxx xxxxxxxxxxxxxx =
xxx xxxxxxxxxxxxxx(“xxxxx”, “xxxxx”, “222-22-2222”, 16.75, 40);
xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx =
xxx xxxxxxxxxxxxxxxxxx(
“xxx”, “xxxxx”, “333-33-3333”, 10000, .06);
BasePlusCommissionEmployee basePlusCommissionEmployee = new BasePlusCommissionEmployee( “Bob”, “Lewis”, “444-44-4444”, 5000, .04, 300);
PieceWorker pieceWorker = new PieceWorker(“Jacques”, “Brode”, “555-55-5555”, 20, 44);
System.out.println(“Employees processed individually:”);
System.out.printf(“%n%s%n%s: $%,.2f%n%n”, salariedEmployee, “earned”, salariedEmployee.earnings()); System.out.printf(“%s%n%s: $%,.2f%n%n”, hourlyEmployee, “earned”, hourlyEmployee.earnings());
xxxxxx.xxx.xxxxxx(“%x%x%x: $%,.2x%x%x”,
xxxxxxxxxxxxxxxxxx, “xxxxxx”, xxxxxxxxxxxxxxxxxx.xxxxxxxx());
xxxxxx.xxx.xxxxxx(“%x%x%x: $%,.2x%x%x”,
xxxxxxxxxxxxxxxxxxxxxxxxxx,
“xxxxxx”, xxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxx());
xxxxxx.xxx.xxxxxx(“%x%x%x: $%,.2x%x%x”,
Preview PieceWorker.java
}
// xxx xxxxxxxx�x xxxx
xxxxxx xxxxxx xxxxxxx() {
xxxxxx xxxx;
}
// set employee�s wage public void setWage(double wage) { this.wage = wage; }
// get number of pieces produced public int getPieces() { return pieces; }
// xxx xxxxxx xx xxxxxx xxxxxxxx
xxxxxx xxxx xxxxxxxxx(xxx xxxxxx) {
xxxx.xxxxxx = xxxxxx;
}
// xxxxxxxxxx xxx xxxxxxxx’x xxxxxxxx
Preview SalariedEmployee.java
{
xxxxx(xxxxxxxxx, xxxxxxxx, xxxxxxxxxxxxxxxxxxxx);
xx (xxxxxxxxxxxx < 0.0) xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx( "Weekly salary must be >= 0.0″);
this.weeklySalary = weeklySalary; }
// set salary public void setWeeklySalary(double weeklySalary) { if (weeklySalary < 0.0) throw new IllegalArgumentException( "Weekly salary must be >= 0.0″);
xxxx.xxxxxxxxxxxx = xxxxxxxxxxxx;
}
// xxxxxx xxxxxx
xxxxxx xxxxxx xxxxxxxxxxxxxxx()
{
List Price: $19
You May Also Like:
CSIS 312 Assignment 1 Time2 Class
CSIS 312 Entire Course
CSIS 312 Assignment 2 Employee Class
CSIS 312 Assignment 4 Random Sentences
CSIS 312 Assignment 5 LinkedList Object
CSIS 312 Assignment 6 printArray and Factorial Calculator
CSIS 312 Assignment 7 Pair Class
CSIS 312 Assignment 8 Stack Data Structure
CSIS 312 Assignment 6 Print Array
CSIS 312 Assignment 8 SecureRandom

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.