Class SalariedEmployee

  • All Implemented Interfaces:
    Employee

    public class SalariedEmployee
    extends java.lang.Object
    implements Employee
    A representation of a salaried employee, who is paid a fixed amount every pay period
    • Constructor Summary

      Constructors 
      Constructor Description
      SalariedEmployee​(java.lang.String name, java.lang.String title, int id, double salary)
      All salaried employees have name, title, id and current pay period salary
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double pay​(double taxRate)
      Process the pay, returning the final amount (salary * (1 - tax rate)*)
      java.lang.String toString()
      Return the string value as title + name
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SalariedEmployee

        public SalariedEmployee​(java.lang.String name,
                                java.lang.String title,
                                int id,
                                double salary)
        All salaried employees have name, title, id and current pay period salary
        Parameters:
        name - Their name representing the person
        title - Their title or job description
        id - Their employee id number
        salary - Their current salary for each pay period
    • Method Detail

      • toString

        public java.lang.String toString()
        Return the string value as title + name
        Specified by:
        toString in interface Employee
        Overrides:
        toString in class java.lang.Object
        Returns:
        "title name"
      • pay

        public double pay​(double taxRate)
        Process the pay, returning the final amount (salary * (1 - tax rate)*)
        Specified by:
        pay in interface Employee
        Parameters:
        taxRate - The current tax rate that will be deducted from their pay
        Returns:
        The net pay amount, salary * (1 - taxRate)