Abstract in Java 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 Note: Class Person is already loaded in this activity. No need to add the class in your code.

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

Abstract in Java

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


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

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
Note:
Class Person is already loaded in this activity. No need to add the class in your code.
For example:
fule Josef Ato", "Cebu City", 23, "Accenture", 40, 550.98);
nings());
Linc Josef Ato", "Talisay City", 28, "Alliance", 41, 600.00);
nings());
"Yule Josef Ato", "Cebu City", 23, "Accenture", 40, 550.98);
"Linc Josef Ato", "Talisay City", 28, "Alliance", 41, 600.00);
Result
Name: Yule Josef Ato
Address: Cebu City
Age: 23
Company name: Accenture
Hours worked: 40
Rate: 550.98
Earnings: 22039.2
Name
Address
: Linc Josef Ato
: Talisay City
: 28
Age
Company Name: Alliance
Earnings: 36900.0
false
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 Note: Class Person is already loaded in this activity. No need to add the class in your code. For example: fule Josef Ato", "Cebu City", 23, "Accenture", 40, 550.98); nings()); Linc Josef Ato", "Talisay City", 28, "Alliance", 41, 600.00); nings()); "Yule Josef Ato", "Cebu City", 23, "Accenture", 40, 550.98); "Linc Josef Ato", "Talisay City", 28, "Alliance", 41, 600.00); Result Name: Yule Josef Ato Address: Cebu City Age: 23 Company name: Accenture Hours worked: 40 Rate: 550.98 Earnings: 22039.2 Name Address : Linc Josef Ato : Talisay City : 28 Age Company Name: Alliance Earnings: 36900.0 false
1-class Employee extends Person (
private String companyName;
2
3
4
5
6
7
8
9
19
11
12
13.
14
15
16.
17
18
19
20
21
22
23
25
26
27
28
43 32 38335 35 83 841 2
29
30 }
31
36
39
40
42
43
44
45
46
class
33 -{
34
47
48
49
2285545555
50
51
53
37. public HourlyEmployee (String name, String address, int age, String cName
56
public Employee (String name, String address, int age, String companyName
super (name, address, age);
this.companyName= companyName;
57
}
public Employee() {
}
public void setCompanyName(String cname) {
companyName= cname;
CHECK
}
public String getCompanyName() {
return company Name;
}
// 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
HourlyEmployee extends Employee
private int hoursWorked;
private double rate;
//total number of hours worked
// rate per hour
}
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 48,
// the rate increases to 150% of the current rate.
// (ex. rate=200; 158% = 380)
// override the toString() and equals() methods
Transcribed Image Text:1-class Employee extends Person ( private String companyName; 2 3 4 5 6 7 8 9 19 11 12 13. 14 15 16. 17 18 19 20 21 22 23 25 26 27 28 43 32 38335 35 83 841 2 29 30 } 31 36 39 40 42 43 44 45 46 class 33 -{ 34 47 48 49 2285545555 50 51 53 37. public HourlyEmployee (String name, String address, int age, String cName 56 public Employee (String name, String address, int age, String companyName super (name, address, age); this.companyName= companyName; 57 } public Employee() { } public void setCompanyName(String cname) { companyName= cname; CHECK } public String getCompanyName() { return company Name; } // 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 HourlyEmployee extends Employee private int hoursWorked; private double rate; //total number of hours worked // rate per hour } 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 48, // the rate increases to 150% of the current rate. // (ex. rate=200; 158% = 380) // override the toString() and equals() methods
Expert Solution
steps

Step by step

Solved in 6 steps with 1 images

Blurred answer
Knowledge Booster
Developing computer interface
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