COMPLETE THE JAVA CODE BELOW SEE ATTACHED PHOTO FOR THE PROBLEM AND THE OUTPUT

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...
icon
Related questions
Question

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
Transcribed Image Text:Result Name: Yule Josef Ato Address: Cebu City Age: 23 Company name: Accenture Hours worked: 40 Rate: 550.98 Earnings: 22039.2
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
Transcribed Image Text: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
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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…
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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY