Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question
java code
[画像:LTE grossaper 9:59 The classes Name and Date are separate classes used as properties in the Employee class. Class Employee is the superclass of the classes SalariedEmployee and Hourly Employee. The superclass has the attributes name and date of hire and methods to set and get these attributes. It also has 2 methods: equals() which check if the objects are same and toString() which convert the properties to a printable string. Also the method read() which used as an input method. The SalariedEmployee subclass has in addition to the attributes of the super-class the attribute annualSalary and set and get methods for it. This class also defines the read() method and grossPay() which in this case returns the salary of the employee. The HourlyEmployee subclass has in addition to the attributes of the super-class, the hours Worked and hourlyRate attributes. It provides 'get' and 'set' methods for these attributes. Also it provides the methods equals() and toString(). Finally, it provides an implementation of the method grossPay(), which returns the product of the hourly rate with the hours worked for each employee. Ims.kku.edu.sa After creating this class hierarchy create a Main class with a main function. This function will have an array of type Employee and size 2. Place in the position 0 of this array a SalariedEmployee object and in the position 1 an Hourly Employee object. Then set some appropriate values for the two objects. Finally create a loop that calls the grossPay() method on both objects of the array and display the .returned value]
expand button
Transcribed Image Text:LTE grossaper 9:59 The classes Name and Date are separate classes used as properties in the Employee class. Class Employee is the superclass of the classes SalariedEmployee and Hourly Employee. The superclass has the attributes name and date of hire and methods to set and get these attributes. It also has 2 methods: equals() which check if the objects are same and toString() which convert the properties to a printable string. Also the method read() which used as an input method. The SalariedEmployee subclass has in addition to the attributes of the super-class the attribute annualSalary and set and get methods for it. This class also defines the read() method and grossPay() which in this case returns the salary of the employee. The HourlyEmployee subclass has in addition to the attributes of the super-class, the hours Worked and hourlyRate attributes. It provides 'get' and 'set' methods for these attributes. Also it provides the methods equals() and toString(). Finally, it provides an implementation of the method grossPay(), which returns the product of the hourly rate with the hours worked for each employee. Ims.kku.edu.sa After creating this class hierarchy create a Main class with a main function. This function will have an array of type Employee and size 2. Place in the position 0 of this array a SalariedEmployee object and in the position 1 an Hourly Employee object. Then set some appropriate values for the two objects. Finally create a loop that calls the grossPay() method on both objects of the array and display the .returned value
[画像:Write a java program as shown in the following UML class diagram :( read the details below) Name - first: String - initial : char - last: String nnualSalary: double Name(): void Name(String afirst, char aninitial, String alast) void read() veid getFirst(): String getInitial() : char String getLast (): String setFirst (String newfirst) void setInitial tchar nevinitial): veid void setLast (String newlast) : void tostring(): String equala (Nane other): boolean - int month int - int day: int - int year: int Date(): void + Date(int aMonth, int aDay, int aYear) : void read():void get Month(): int getDay(): int get Year () int set Month(int newMonth): void setDay(int newDay) : void SalariedEmployee Date set Year (int newYear): void toString(): String equals(Name other): boolean mlariedispleyee():void mlariedmployee (Nane, Date airbate, double andalary): ved ad): void ouble getAnnualfalary(): double id setAnnualSalary(double nevad dtring() String quals (Salariedmployee other): boolean rossPay(): double Employee enplane Nane hireDate Date Exployee void Exployee ane lane, Date abate void read():void getplane) getiredate(): Date pane ane sevinplane) : veid setirate (late sevirebate) veid teltring ti equals(Name other) belan Hourly Employee hourlytate double -hoursworked double HourlyEmployed Hourlymployee (ane ampliane, Datate, double anat double anders vold read veid getourlyRate() double get our worked double widerstatedouble neuvid e turkedidouble newoud totring() in equals(NourlyEmployee other): boolean double ressa]
expand button
Transcribed Image Text:Write a java program as shown in the following UML class diagram :( read the details below) Name - first: String - initial : char - last: String nnualSalary: double Name(): void Name(String afirst, char aninitial, String alast) void read() veid getFirst(): String getInitial() : char String getLast (): String setFirst (String newfirst) void setInitial tchar nevinitial): veid void setLast (String newlast) : void tostring(): String equala (Nane other): boolean - int month int - int day: int - int year: int Date(): void + Date(int aMonth, int aDay, int aYear) : void read():void get Month(): int getDay(): int get Year () int set Month(int newMonth): void setDay(int newDay) : void SalariedEmployee Date set Year (int newYear): void toString(): String equals(Name other): boolean mlariedispleyee():void mlariedmployee (Nane, Date airbate, double andalary): ved ad): void ouble getAnnualfalary(): double id setAnnualSalary(double nevad dtring() String quals (Salariedmployee other): boolean rossPay(): double Employee enplane Nane hireDate Date Exployee void Exployee ane lane, Date abate void read():void getplane) getiredate(): Date pane ane sevinplane) : veid setirate (late sevirebate) veid teltring ti equals(Name other) belan Hourly Employee hourlytate double -hoursworked double HourlyEmployed Hourlymployee (ane ampliane, Datate, double anat double anders vold read veid getourlyRate() double get our worked double widerstatedouble neuvid e turkedidouble newoud totring() in equals(NourlyEmployee other): boolean double ressa
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY