COMPLETE THE JAVA CODE BELOW SEE ATTACHED PHOTO FOR THE PROBLEM AND THE OUTPUT
COMPLETE THE JAVA CODE BELOW
SEE ATTACHED PHOTO FOR THE PROBLEM AND THE OUTPUT
class Employee extends Person {
private String companyName;
public Employee(String name,String address,int age,String companyName) {
super(name,address,age);
this.companyName = companyName;
}
public Employee() {
}
public void setCompanyName(String cname){
companyName = cname;
}
public String getCompanyName(){
return companyName;
}
// Override the display method in the Person class
// define earnings as an abstract method with a return type of double
// override the toString() and equals() methods
}
class HourlyEmployee extends Employee
{
private int hoursWorked; //total number of hours worked
private double rate; // rate per hour
public HourlyEmployee(String name,String address,int age,String cName,int hoursWorked,double rate) {
}
public HourlyEmployee(String name,String address,int age,String cName) {
hoursWorked = 0;
rate = 0;
}
// provide the setters and getters of your data members
//earnings is computed by having the product of
//the total number of hours worked and the rate.
// but if the number of hours worked exceeds 40,
// the rate increases to 150% of the current rate.
// (ex. rate=200; 150% = 300)
// override the toString() and equals() methods
}
![Result
Name: Yule Josef Ato
Address: Cebu City
Age: 23
Company name: Accenture
Hours worked: 40
Rate: 550.98
Earnings: 22039.2](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb7bda6dc-5fd7-42c5-9060-21c9690360fd%2F7e41bf13-9fbc-4fea-b2c1-1b5f26d758cf%2Fgdk6nlg_processed.png&w=3840&q=75)
![Employee
Override the display method in the Person class
override the toString() and equals() methods
Define method earnings as abstract with a return type of double.
Hourly Employee
provide the setters and getters of your data members
provide call to parent contructors
earnings is computed by having the product of the total number of hours worked and the
rate. but if the number of hours worked exceeds 40, the rate increases to 150% of the current
rate. (ex. rate=200; 150% = 300)
override the toString() and equals() methods](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb7bda6dc-5fd7-42c5-9060-21c9690360fd%2F7e41bf13-9fbc-4fea-b2c1-1b5f26d758cf%2Fi0gogac_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)