wite a java program that will compute an employee's net pay.you will have the following 1) Employee class(external) 2) Boss Class(external) 3) CommissionWorker(external) 4) PieceWorker Class (external) 5) HourlyWorker Class(external) 6) NetPayrollTest Class(driver)
add private instance variables birthdate, deduction rate, and social security number to Class Employee
Assume this payroll is proccessed once per month. then, as your program calculates the payroll for each Employee(polymorphically)add $100.00 bonus to the person's payroll gross amount if it is the month in which the employee's birthday occurs.
The Employee class will contain a private static variables for counting the number of employees and
the total net payroll amount; also static methods used to obtain the current number of employees and the net payroll amount.
The NetPayrollTest application program will send to the external class/es via instantiation all the information each employee have ss3, and birthdate as part of their data. All employee's have a standard deduction of 22.5%
Within the program demonstrate the try/catch logic all classes packaged as follows except the NetPayrollTest which will be in the root: CIS2421/Programs/Assignment
note: all source files will be created in the root dir. and when compiled the class file/s will be directed to the respective package. NetPayrollTest will be compiled an run from the root dir.
I need help bad this is what I have so far
// Employee.java
// Abstract base class Employee.
public abstract class Employee {
private String firstName;
private String lastName;
private String ssNumber;
private String birthDate;
private Date birthDate;
// constructor
public Employee( String first, String last, String ss, int birthMonth, int birthDay, int birthYear, )
{
firstName = first;
lastName = last;
ssNumber = ss;
birthDate = new Date( birthMonth, birthDay, birthYear );
}
// get first name
public String getFirstName()
{
return firstName;
}
// get last name
public String getLastName()
{
return lastName;
}
//get social security Number
public String getssNumber()
{
return ssNumber;
}
// get birthday
public String getbirthDate()
{
return birthDate;
}
// Abstract method that must be implemented for each
// derived class of Employee from which objects
// are instantiated.
public abstract double earnings();
} // end class Employee
// Boss.java
// Boss class derived from Employee.
public final class Boss extends Employee {
private double monthlySalary;
// constructor for class Boss
public Boss( String first, String last, String ss, String birth, double salary )
{
super( first, last, ss, birth ); // call superclass constructor
setMonthlySalary( salary );
}
// CommissionWorker.java
// CommissionWorker class derived from Employee
public final class CommissionWorker extends Employee {
private double salary; // base salary per week
private double commission; // amount per item sold
private int quantity; // total items sold for week
// constructor for class CommissionWorker
public CommissionWorker( String first, String last, String ss, String birth,
double salary, double commission, int quantity )
{
super( first, last, ss, birth ); // call superclass constructor
setSalary( salary );
setCommission( commission );
setQuantity( quantity );
}
// set CommissionWorker's monthly base salary
public void setSalary( double monthlySalary )
{
salary = ( monthlySalary > 0 ? monthlySalary : 0 );
}
Perhaps if you asked a specific question, someone might be able to answer it...
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
what I want to know is if my code is going in the right direction or do I need to start from scratch
Does it work? Does it fit the requirement?
From what I could make out (it would help a lot if it was formatted - doesn't anyone read the submission guidelines?) it looks OK, but I didn't see any try...catch code, and they are probably expecting you to process each employee object with the same piece of code to demonstrate polymorphism. You might try adding each employee object to an array or container as it is created, then iterating through the container (possibly after passing it to another method?) retrieving the employee objects and outputting their details.
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Bookmarks