Question

In: Computer Science

JAVA PROGRAMING In a particular factory,a shift supervisor is a salaried employee who supervises a shift.In...

JAVA PROGRAMING

In a particular factory,a shift supervisor is a salaried
employee who supervises a shift.In addition to a salary,the
shift supervisor earns a yearl bonus when his or her
shift meets production goals.Design a ShiftSupervisor
class that extends the Employee class. TheShiftSupervisor class should have a field that holds
the annual salary and a field that holds the annual production
bonus that a shift supervisor has earned.Write one or more constructor
and the appropriate accessor and mutator methods for the class.Demonstrate
the class by writing a program that uses a ShiftSupervisor object.

Solutions

Expert Solution

Hi, Please find my implementation of required classes.

Please let me know in case of any issue.

################# Employee.java ##############

public class Employee
{

   // fields
   private String Empname;
   private String Empnumber;
   private String Hiredate;

   // contructor
   public Employee(String Empname,String Empnumber,String Hiredate)
   {
       setName (Empname);
       setNumber (Empnumber);
       setHireDate (Hiredate);

   }
   //accessor
   public String getName()
   {
       return Empname;
   }

   public String getNumber()
   {
       return Empnumber;
   }

   public String getHireDate()
   {
       return Hiredate;
   }

   // mutator
   public void setName(String n)
   {
       Empname = n;
   }

   public void setNumber(String num)
   {
       Empnumber = num;
   }

   public void setHireDate(String h)
   {
       Hiredate = h;
   }

}

################# ShiftSupervisor.java ##############


public class ShiftSupervisor extends Employee
{
   //fields
   private double annualsalary;
   private double annualproduction;

   //constructor
   public ShiftSupervisor(String Empname, String Empnumber, String Hiredate, double annualsalary, double annualproduction)
   {
       super(Empname, Empnumber,Hiredate);
       setAnuaSal (annualsalary);
       setAnuPro (annualproduction);
   }

   // accessor
   public double getAnuaSal()
   {
       return annualsalary;
   }

   public double getAnuPro()
   {
       return annualproduction;
   }

   // mutator
   public void setAnuSal (double s)
   {
       annualsalary = s;

   }

   public void setAnuPro (double p)
   {
       annualproduction = p;
   }
   public String toString()
   {
       return " Name:"+getName()+"\nEmpID:"+getNumber()+"\nHire Date:"+getHireDate()+"\nAnnual Salary:"+annualsalary+ "\nProduction"+annualproduction;
   }
   private void setAnuaSal(double annualsalary) {
       throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
   }
}

############## Demo class #########

public class ShiftEmployeeTest {

  

   public static void main(String[] args) {

      

       ShiftSupervisor emp = new ShiftSupervisor("Pravesh", "12A", "11/12/2000", 432123, 43);

      

       System.out.println(emp);

      

       System.out.println("\nAnnual salary: "+emp.getAnuaSal());

   }

}

/*

Sample run:

Name:Pravesh

EmpID:12A

Hire Date:11/12/2000

Annual Salary:432123.0

Production43.0

Annual salary: 432123.0

*/


Related Solutions

Janna is a salaried nonexempt employee in Laramie, Wyoming, who earns $25,000 per year for a...
Janna is a salaried nonexempt employee in Laramie, Wyoming, who earns $25,000 per year for a standard 40-hour workweek and is paid biweekly. She is single with one withholding allowance. During the last pay period, she worked 5 hours of overtime. She contributes 3% of her gross pay to her 401(k) on a pre-tax basis and has a garnishment of 10% of her disposable income for a consumer credit garnishment. What is her net pay? (Use the wage-bracket method. Do...
Aimee is a salaried nonexempt employee who earns an annual salary of $54,000 for a 35-hour...
Aimee is a salaried nonexempt employee who earns an annual salary of $54,000 for a 35-hour workweek, paid biweekly. The employer pays overtime for any hours worked in excess of 35 per week. During a pay period, she worked 73.5 hours. She has requested that she take compensatory time in lieu of paid overtime. How much compensatory time should she receive, assuming that her firm approves the compensatory time? 3.5 hours 2.75 hours 5.25 hours 10.25 hours
Company organized into DEPARTMENT. Each department has unique name and a particular employee who manages the...
Company organized into DEPARTMENT. Each department has unique name and a particular employee who manages the department. Start date for the manager is recorded. Department may have several locations.  A department controls a number of PROJECTS. Projects have a unique name, number and a single location.  Company’s EMPLOYEE name, ssno, address, salary, sex and birth date are recorded. An employee is assigned to one department, but may work for several projects (not necessarily controlled by her dept). Number...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT