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

Classes Employee, Salesperson, Supervisor. Class Employee has private string mem

ID: 3768906 • Letter: C

Question

Classes Employee, Salesperson, Supervisor. Class Employee has private string members that represent First Name, Middle Initial and Last Name. It also has an integer member representing the base salary. Salesperson inherits from class Employee. It has two integer members representing Sales Amount and Percent of Commission. Class Supervisor inherits from class Employee. It has two integer members representing number of subordinates and Supervision Bonus.

Main application is a program that allows user to create an instance and to produce a list of each class instance created and corresponding final salary. (PS: Use Java!!!!)

Explanation / Answer

class Employee
{
private
   String fname, mname, lname;
   int bs;
   void set(String f, String m, String l, int b)
   {
       fname=f;
       mname=m;
       lname=l;
       bs=b;
   }
   int getbs()
   {
       return bs;
   }  
   String getfname()
   {
       return fname;
   }  

   String getmname()
   {
       return mname;
   }  
   String getlname()
   {
       return lname;
   }  

}

class Salesperson extends Employee
{
   int salesamt, percentcom;
   Salesperson(int sa, int per)
   {
       salesamt=sa;
       percentcom=per;
   }
}

class Supervisor extends Employee
{
   int nosub, nosup;
   Supervisor(int sub, int sup)
   {
       nosub=sub;
       nosup=sup;
   }
}

class finalsalary
{
   public static void main(String args[])
   {
       Employee o = new Employee();      

o.set("aaa","bbb","ccc",10000);
       Salesperson o1=new

Salesperson(10000,10);
       Supervisor o2 = new Supervisor

(10,20);
       int bs=o.getbs();
       String lname=o.getlname();
       String fname=o.getfname();
      
       String mname=o.getmname();

       double

com=o1.salesamt*o1.percentcom/100;
      
       double finalsal= bs+com;
       System.out.println("Final salary

="+finalsal);
   }
}