Question: Use Java and I need Picture for Output Write the superclass Worker and its subclasses WorkerWI (Salary with timeout) and Workers. (Salary only), as shown


Use Java and I need Picture for Output
Write the superclass Worker and its subclasses WorkerWI (Salary with timeout) and Workers. (Salary only), as shown in the class diagram. Worker #idhi jata #name String #basicSalary double Strikethrough +Darker +Warkerlidiintname: String, salary: double) +getId():inta +setId(id:intlivoid +getName(): String +setName. (name: String) :void +getsalary() :double +setsalary (basicSalary: double):void + tastring(): String WorkerWT #workedHourseni double #transportation i double #housing double +WorkerWT (id:int, name:String, salary: double,workedHourse: double, transportation:double, housing:double) +getsalary():double +taString(): String Workers #transportation i double #housingni double +Workers (id:int,name: String,salary: double, transpo rtation: double, housing: double) +getsalary():double +taString(): String Consider a superclass Worker which models a Worker. This class has: Three private instance variables id (int) name (String) and basicSalarx (double). One constructor to initialize the instance variables use thisQ. A default constructor to initialize id to 0, name to none", and basicSalary to 0.0 use this() Accessor and mutator methods. A method getSalary that returns the basicSalary toString0 method to return the id, name and basicSalarx It should be as shown in the sample output. o Consider two subclasses WorkerWI (Salary with overtime) and Workers (Salary only). Worker WT has three additional instance variable worked Hourse (double), transportation (double) and housing (double) and all of them private, while Workers has two additional instance variables transportation (double) and housing (double) both private. Write an appropriate constructor for each of the classes making use of the constructor of the superclass in defining those of the subclasses. Override getSalary() method that returns the total Salary of a worker based on : For WorkerWT class find the money paid by hours by using this formula: ((Basic Salary/30 )*worked Hourse) then add it to the basicSalary, transportation and housing For Workers. class add transportation and housing to the basicSalary Make use of getSalary, of the superclass. Override also toString() method for each class making use of the toString() method of the superclass in defining those of the subclasses. (toString0 should return something that can be printed on the screen follow the output sample). Write an application class where you construct objects from the two subclasses and print them on the screen. Sample Output: run : Welcome Worker id : 11231 Name : Fahd Mousa Basic salary: 7000.0 Your Salary information with timeout as bellow : Basic Salary: 7000.0 Worked Hourse : 21.0 Transportation : 800.0 Housing : 1200.0 Total Salary is : 13900.0 ===== Ibrahim Bader Welcome Worker id : 12680 Name : Basic salary : 8700.0 Your Salary information as bellow : Basic Salary : 8700.0 Transportation : 900.0 Housing : 850.0 Total Salary is : 10450.0 -- BUILD SUCCESSFUL (total time: 0 seconds)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
