Class Person is already loaded in this activity. No need to add the class to your cod

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Complete the java code given below:

 

Note:
Class Person is already loaded in this activity. No need to add the class to your code.

Test Result that should be seen.

Test Result

HourlyEmployee h = new HourlyEmployee("Yule Josef Ato","Cebu City",23,"Accenture",40, 550.98);

System.out.println(h);

System.out.println("\nEarnings: "+h.earnings());

Name: Yule Josef Ato

Address: Cebu City

Age: 23 Company name: Accenture

Hours worked: 40

Rate: 550.98

Earnings: 22039.2

HourlyEmployee h = new HourlyEmployee("Linc Josef Ato","Talisay City",28,"Alliance",41, 600.00);

h.display();

System.out.println("\nEarnings: "+h.earnings());

Name : Linc Josef Ato

Address : Talisay City

Age : 28 Company Name: Alliance Earnings: 36900.0

HourlyEmployee h1 = new HourlyEmployee("Yule Josef Ato","Cebu City",23,"Accenture",40, 550.98);

HourlyEmployee h2 = new HourlyEmployee("Linc Josef Ato","Talisay City",28,"Alliance",41, 600.00);

System.out.println(h1.equals(h2));

false

complete this code:

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

}

Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education