Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Define an abstract class named Employee. Define following classes to inherit the

ID: 3572016 • Letter: D

Question

Define an abstract class named Employee. Define following classes to inherit the abstract class, Boss class, indicate the boss who get paid with a fixed salary without considering working hours; Commission Work class, indicate the workers who some basic salary and floating wages according to sales; Pieceworker class, indicate those who are paid according to the numbers of products; Hourly Worker class, indicate those get paid according to their working hours. Define above four classes, to implement the abstract methods declared in the abstract class; getPaid() method without any parameter but have a return value for total salary, and, display() method for output the information about the employee. And define another class with main method (also called test class or driven class), to test the methods defined.

Explanation / Answer

import java.io.*; /* importing required number of packages*/
import java.util.*;
abstract class Employee{
   static double getpaid(){
   System.out.println("Boss Salary : "+sal);
       return 0.0;
   }
   void display(){
   }
}
class boss extends Employee {
   double sal=1000.00;
   Employee.getpaid();
}
class commissionWork extends Employee {
}
class pieceWorker extends Employee{
}
class HourlyWorker extends Employee{
}
public class s{
   public static void main(String args[ ]){
       boss b=new boss();
       commissionWork c=new commissionWork();
       HourlyWorker h=new HourlyWorker();
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote