PRO192_-_PE02_-_SU_2025_4005.webp
T

PRO192_-_PE02_-_SU_2025_4005.webp

☑Kizspy.me
Zoom
3 of 4
Paper No: 1
(3 marks)
Write a class named Employee and a class named Boss extended from Employee (i.e. Employee is a
superclass and Boss is a subclass):
-id: String
-name:String
-salary: double
+ Employee()
Employee
+ Employee(id:String, name:String,
salary: double)
+getIncome(): double
+ Getters & Setters
+ toString(): String
Where:

Employee () default constructor
Employee(id:String, name:String, salary: double):
- parameterized constructor, which sets values to
id, name and salary.
Getters & Setters: write the setters and getters of
all the fields.
getincome(): double return the income with
income 12*salary.
⚫ toString():String - return a string that contains the
information of the Employee: id, name, income.
The income is formatted by two decimal places.
Boss
Where:
-extra: double

Boss() default constructor
-level:int
.
Boss(id: String, name:String
+ Boss()
+ Boss(id: String, name:String
salary: double, extra: double, level:
int)
+ Getters & Setters
+getIncome(): double
+ toString(): String
+100%
.
salary: double, extra: double, level: int)-
parameterized constructor, which sets the value to
the id, name, salary, extra, and level
Getters & Setters: write the setters and getters of
all the fields
getIncome(): double return the income is
calculated according to the following formula:
Close
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
ThuyPhuong86
Ngày thêm
Lượt xem
4,535
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom