CSIS 212 Programming Assignment 8 Payroll Modification
$19.00
Description
Exercise 9.5 JHTP: Draw an inheritance hierarchy for students at a university similar to the hierarchy shown in Fig 9.2. Use Student as the superclass of the hierarchy, then, extend Student with classes Undergraduate Student and Graduate Student. Continue to extend the hierarchy as deep (i.e., as many levels as possible). For example, Freshmen, Sophomore, Junior, and the Senior might extend Undergraduate Student and Doctoral Student and Masters Student might be subclasses of Graduate Students. After drawing the hierarchy, discuss the relationships that exist between the classes. [Note: You do not need to write any code for this exercise].
Exercise 10.6: How does polymorphism promote extensibility?
Exercise 10.12: Payroll Modification Modify the payroll system of Figs 10.4 –10.9 to include private instance variable birthdate in class Employee. Use class Date of Fig 8.7 to represent an employee’s birthday. Add get methods to class Date. Assume that payroll is processed once per month. Create an array of Employee variables to store references to the various employee objects. In a loop, calculate the payroll for each Employee (polymorphic ally), and add a $100.00 bonus to the persons payroll amount if the current month is the one in which the Employee’s birthdate occurs.
This assignment is due by 11:59 p.m. (ET) on Monday.
SCREENSHOTS
SOLUTION
PAYMENT
CSIS212 Assignment 8 Report
CSIS212 Assignment 8
CSIS212 Assignment 8
CSIS212 Assignment 8
The solution consists of:
A report word document for this assignment
All Java programs in case you want to run theses programs on your computer.
Screenshots while running programs
Attachments [Move over files to preview content of those files]
CSIS212_Assignment_8.zip (605.33 KB)
CSIS212-Assignment-8-Report-Screenshot.png
CSIS212-Assignment-8-Screenshot-1.png
CSIS212-Assignment-8-Screenshot-2.png
CSIS212-Assignment-8-Screenshot.png
CSIS_212_Assignment_8_Report.docx
Exercise 10.6.docx
Exercise 9.5.docx
Source Code
BasePlusCommissionEmployee.java
CommissionEmployee.java
Date.java
Employee.java
HourlyEmployee.java
PayrollSystemTest.java
PieceWorker.java
SalariedEmployee.java
Preview BasePlusCommissionEmployee.java
xxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxxxxxxxxxxxxx
{
xxxxxxx xxxxxx xxxxxxxxxx; // xxxx xxxxxx xxx xxxx
// xxx-xxxxxxxx xxxxxxxxxxx
public BasePlusCommissionEmployee( String first, String last, String ssn, Date DayOfBirth,double sales, double rate, double salary ) { super( first, last, ssn, DayOfBirth,sales, rate ); setBaseSalary( salary ); // validate and store base salary } // end six-argument BasePlusCommissionEmployee constructor
// xxx xxxx xxxxxx
xxxxxx xxxxx xxxx xxxxxxxxxxxxx( xxxxxx xxxxxx )
{
xxxxxxxxxx = ( xxxxxx < 0.0 ) ? 0.0 : xxxxxx; // xxx-xxxxxxxx
} // xxx xxxxxx xxxxxxxxxxxxx
Preview CommissionEmployee.java
xxxxxxxxxxxxxxxxx( xxxx );
} // xxx xxxx-xxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxx
// xxx xxxxxxxxxx xxxx
xxxxxx xxxxx xxxx xxxxxxxxxxxxxxxxx( xxxxxx xxxx )
{ commissionRate = ( rate > 0.0 && rate < 1.0 ) ? rate : 0.0; } // end method setCommissionRate
// return commission rate public double getCommissionRate() { return commissionRate; } // end method getCommissionRate
// set gross sales amount public final void setGrossSales( double sales )
{
xxxxxxxxxx = ( xxxxx < 0.0 ) ? 0.0 : xxxxx;
} // xxx xxxxxx xxxxxxxxxxxxx
// xxxxxx xxxxx xxxxx xxxxxx
xxxxxx xxxxxx xxxxxxxxxxxxx()
Preview Date.java
xxxxxx xxxx(xxx xxxxxxxx, xxx xxxxxx, xxx xxxxxxx) {
xxxxx = xxxxxxxx; // xxxxxxxx xxxxx
xxxx = xxxxxxx; // xxxxx xxxxxxxx xxxx
xxx = xxxxxxxx(xxxxxx); // xxxxxxxx xxx
} // xxx xxxx xxxxxxxxxxx
public void setMonth(int theMonth) { month = theMonth; }
// utility method to confirm proper month value public int getMonth() { if (month > 0 && month <= 12) // validate month { return month; } return 0;
} // xxx xxxxxx xxxxxxxxxx
// xxxxxxx xxxxxx xx xxxxxxx xxxxxx xxx xxxxx xxxxx xx xxxxx xxx xxxx
xxxxxxx xxx xxxxxxxx(xxx xxxxxxx) {
xxx xxxxxxxxxxxx[]
= {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
Preview Employee.java
xxxxxx xxxxxxxx(xxxxxx xxxxx, xxxxxx xxxx, xxxxxx xxx, xxxx xxxxxxxxxx) {
xxxxxxxxx = xxxxx;
xxxxxxxx = xxxx;
xxxxxxxxxxxxxxxxxxxx = xxx;
xxxxxxxx = xxxxxxxxxx;
} // end three-argument Employee constructor
// set first name public void setFirstName(String first) { firstName = first; } // end method setFirstName
// return first name public String getFirstName() { return firstName; } // end method getFirstName
// xxx xxxx xxxx
xxxxxx xxxx xxxxxxxxxxx(xxxxxx xxxx) {
xxxxxxxx = xxxx;
} // xxx xxxxxx xxxxxxxxxxx
// xxxxxx xxxx xxxx
Preview HourlyEmployee.java
xxxxxxxx( xxxxxxxxxxx ); // xxxxxxxx xxx xxxxx xxxxx xxxxxx
} // xxx xxxx-xxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxx
// xxx xxxx
xxxxxx xxxxx xxxx xxxxxxx( xxxxxx xxxxxxxxxx )
{ wage = ( hourlyWage < 0.0 ) ? 0.0 : hourlyWage; } // end method setWage
// return wage public double getWage() { return wage; } // end method getWage
// set hours worked public final void setHours( double hoursWorked )
{
xxxxx = ( ( xxxxxxxxxxx >= 0.0 ) && ( xxxxxxxxxxx <= 168.0 ) ) ?
xxxxxxxxxxx : 0.0;
} // xxx xxxxxx xxxxxxxx
// xxxxxx xxxxx xxxxxx
Preview PayrollSystemTest.java
xxxxxxxxxxxxxx xxxxxxxxxxxxxx =
xxx xxxxxxxxxxxxxx( "xxxxx", "xxxxx", "222-22-2222", xxx xxxx(6,15,1988),16.75, 40 );
xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx =
xxx xxxxxxxxxxxxxxxxxx(
"xxx", "xxxxx", "333-33-3333", xxx xxxx(8,25,1974),10000, .06 );
BasePlusCommissionEmployee basePlusCommissionEmployee = new BasePlusCommissionEmployee( "Bob", "Lewis", "444-44-4444", new Date(9,27,1978),5000, .04, 300 ); PieceWorker pieceWorker = new PieceWorker("Ralph", "Tang", "777-223-987", new Date(6,25,1985), 213, 16);
System.out.println( "Employees processed individually:
" );
System.out.printf( "%s
%s: $%,.2f", salariedEmployee, "earned", salariedEmployee.earnings() ); System.out.printf( "%s
%s: $%,.2f", hourlyEmployee, "earned", hourlyEmployee.earnings() );
xxxxxx.xxx.xxxxxx( "%xx%x: $%,.2xxx",
xxxxxxxxxxxxxxxxxx, "xxxxxx", xxxxxxxxxxxxxxxxxx.xxxxxxxx() );
xxxxxx.xxx.xxxxxx( "%xx%x: $%,.2xxx",
xxxxxxxxxxxxxxxxxxxxxxxxxx,
"xxxxxx", xxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxx() );
xxxxxx.xxx.xxxxxx( "%xx%x: $%,.2xxx",
Preview PieceWorker.java
} // xxx xxxx-xxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxx
// xxx xxxx
xxxxxx xxxxx xxxx xxxxxxx( xxxxxx xxxx )
{
wage = ( Wage < 0.0 ) ? 0.0 : Wage; } // end method setWage
// return wage public double getWage() { return wage; } // end method getWage
// set Pieces public final void setPieces( double Pieces ) {
xxxxxx = ( ( xxxxxx >= 0.0 ) && ( xxxxxx <= 168.0 ) ) ?
xxxxxx : 0.0;
} // xxx xxxxxx xxxxxxxxx
// xxxxxx xxxxxx
xxxxxx xxxxxx xxxxxxxxx()
Preview SalariedEmployee.java
xxxxxx xxxxx xxxxxxxxxxxxxxxx xxxxxxx xxxxxxxx
{
xxxxxxx xxxxxx xxxxxxxxxxxx;
// xxxx-xxxxxxxx xxxxxxxxxxx
public SalariedEmployee( String first, String last, String ssn, Date DayOfBirth, double salary ) { super( first, last, ssn, DayOfBirth); // pass to Employee constructor setWeeklySalary( salary ); // validate and store salary } // end four-argument SalariedEmployee constructor
// set salary
xxxxxx xxxxx xxxx xxxxxxxxxxxxxxx( xxxxxx xxxxxx )
{
xxxxxxxxxxxx = xxxxxx < 0.0 ? 0.0 : xxxxxx;
} // xxx xxxxxx xxxxxxxxxxxxxxx
// xxxxxx xxxxxx
Price: $19
You May Also Like:
CSIS 212 Programming Assignment 1 Create Five Programs
CSIS 212 Programming Assignment 2 Salary Calculator
CSIS 212 Programming Assignment 3 Bar Chart Printing Program
CSIS 212 Programming Assignment 4 Multiples Circle Area Computer-Assisted Instruction
CSIS 212 Programming Assignment 5 Variable-Length Argument List Dice Rolling
CSIS 212 Programming Assignment 6 Date Class
CSIS 212 Programming Assignment 7 Rectangle Class
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.