employee
Class Employee

java.lang.Object
  extended by employee.Employee

public class Employee
extends java.lang.Object


Constructor Summary
Employee()
          Creates a new default instance of Employee
Employee(java.lang.String last, java.lang.String first)
          creates a new instance of Employee, given last and first name
Employee(java.lang.String last, java.lang.String first, double pay)
          creates a new instance of Employee, given last and first name and current pay rate.
Employee(java.lang.String last, java.lang.String first, double pay, int idLen)
          creates a new instance of Employee, given last and first name and current pay rate and length of the employee ID.
 
Method Summary
 boolean addWeek(double hrs)
          add a weeks worth of data, given the number of hours worked.
 boolean addWeek(int weekNo, double hrs)
          add a weeks worth of data, given the week number and number of hours worked.
 boolean addWeek(Week wk)
          add a weeks worth of data, given the actual Week object to add.
 double getAveHours()
          report ave (mean) hours worked per week.
 double getAvePay()
          report ave (mean) total pay per week.
 double getAvePerHour()
          report ave per hour pay.
 double getCurrPayRate()
          report current pay rate
 java.lang.String getEmployeeID()
          report employee ID - to user of Employee class, this is a String
 java.lang.String getFirstName()
          report employee first name
 java.lang.String getLastName()
          report employee last name
 java.lang.String getLastNameFirst()
          report name, last name first
 java.lang.String getLastWeekString()
          report string representation for last week added.
 Week getNthWeek(int n)
          report work info for Nth week presuming that there are that many weeks.
 double getNthWeekHoursWorked(int n)
          report total hours worked for Nth week presuming that there are that many weeks.
 java.lang.String getNthWeekString(int n)
          report string representation for Nth week presuming that there are that many weeks.
 double getNthWeekTotalPay(int n)
          report total pay for Nth week presuming that there are that many weeks.
 int getNumWeeks()
          report number of weeks of work info
 double getTotalHoursWorked()
          report total hours worked for the employee across all weeks combined
 double getTotalPay()
          report total pay for the employee across all weeks combined
 java.lang.String getWholeName()
          report whole name
 boolean giveRaise(double raise)
          Give a pay raise.
 void setFirstName(java.lang.String first)
          set first name to a sepcific value.
 void setLastName(java.lang.String last)
          set last name to a specific value.
 java.lang.String toString()
          produce a friendly string version of the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Employee

public Employee()
Creates a new default instance of Employee


Employee

public Employee(java.lang.String last,
                java.lang.String first)
creates a new instance of Employee, given last and first name


Employee

public Employee(java.lang.String last,
                java.lang.String first,
                double pay)
creates a new instance of Employee, given last and first name and current pay rate. If the pay rate is too low, it defaults to the minimum wage.


Employee

public Employee(java.lang.String last,
                java.lang.String first,
                double pay,
                int idLen)
creates a new instance of Employee, given last and first name and current pay rate and length of the employee ID. If the pay rate is too low, it defaults to the minimum wage. If the length of the ID is too short, uses default length.

Method Detail

getEmployeeID

public java.lang.String getEmployeeID()
report employee ID - to user of Employee class, this is a String


getLastName

public java.lang.String getLastName()
report employee last name


getFirstName

public java.lang.String getFirstName()
report employee first name


getCurrPayRate

public double getCurrPayRate()
report current pay rate


getWholeName

public java.lang.String getWholeName()
report whole name


getLastNameFirst

public java.lang.String getLastNameFirst()
report name, last name first


getNumWeeks

public int getNumWeeks()
report number of weeks of work info


getNthWeek

public Week getNthWeek(int n)
report work info for Nth week presuming that there are that many weeks. Starts with 1 like humans count.


getNthWeekString

public java.lang.String getNthWeekString(int n)
report string representation for Nth week presuming that there are that many weeks. Starts with 1 like humans count.


getNthWeekTotalPay

public double getNthWeekTotalPay(int n)
report total pay for Nth week presuming that there are that many weeks. Starts with 1 like humans count. Returns negative if n is invalid.


getNthWeekHoursWorked

public double getNthWeekHoursWorked(int n)
report total hours worked for Nth week presuming that there are that many weeks. Starts with 1 like humans count. Returns negative if n is invalid.


getTotalPay

public double getTotalPay()
report total pay for the employee across all weeks combined


getTotalHoursWorked

public double getTotalHoursWorked()
report total hours worked for the employee across all weeks combined


getAvePay

public double getAvePay()
report ave (mean) total pay per week. Returns 0 if no weeks.


getAveHours

public double getAveHours()
report ave (mean) hours worked per week. Returns 0 if no weeks.


getAvePerHour

public double getAvePerHour()
report ave per hour pay. Returns zero if no hours.


getLastWeekString

public java.lang.String getLastWeekString()
report string representation for last week added.


setLastName

public void setLastName(java.lang.String last)
set last name to a specific value. Cannot really validate.


setFirstName

public void setFirstName(java.lang.String first)
set first name to a sepcific value. Cannot really validate.


giveRaise

public boolean giveRaise(double raise)
Give a pay raise. Passed raise should be a decimal. E.g. a 10% raise would be .10. Returns true if the passed value is acceptable (cannot be negative or a ridiculous amount (currently 0.50).


addWeek

public boolean addWeek(Week wk)
add a weeks worth of data, given the actual Week object to add. Always returns true.


addWeek

public boolean addWeek(double hrs)
add a weeks worth of data, given the number of hours worked. Pay rate is assumed to be the Employees current rate. Week number is assumed to be one higher than the last week added. Constructs the object to add. returns true if the number of hours is reasonable.


addWeek

public boolean addWeek(int weekNo,
                       double hrs)
add a weeks worth of data, given the week number and number of hours worked. Pay rate is assumed to be the Employees current rate. Constructs the object to add. returns true if the number of hours is reasonable.


toString

public java.lang.String toString()
produce a friendly string version of the object

Overrides:
toString in class java.lang.Object