1.Test getTitle()
2.Test getAuthor()
3.Test toString()
Enter TC(1/2/3):1
1.Test getTitle()
2.Test getAuthor()
3.Test toString()
Enter TC(1/2/3):2
Enter page count:300
Kizspy.me
Enter page count:200
Enter page count:300
Enter page count:99
1.Test getTitle()
2.Test getAuthor()
3.Test toString()
Enter TC(1/2/3):3
OUTPUT:
OUTPUT:
1.Test getTitle()
2.Test getAuthor()
3.Test toString()
Enter TC(1/2/3):2
OUTPUT:
OUTPUT:
CORE JAVA
N/A
APRESS
100, CORE JAVA, APPRESS, 100
Question 2:
3 of 4
Paper No: 1
Zoom
(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)
+ Getters & Setters
+100%
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.
Close