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 Salaried Employee 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
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 Salaried Employee 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
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd93c310f-e8dd-48f2-8e93-0e282527bf16%2F3c295e62-5350-4237-9209-8d0519bc5cb7%2Fwb5730b_processed.jpeg&w=3840&q=75)
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd93c310f-e8dd-48f2-8e93-0e282527bf16%2F3c295e62-5350-4237-9209-8d0519bc5cb7%2Fywmqmw_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 9 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY