Computers and Technology

Employees example: Abstract class and interface. The classes below describe an abstract class named EmployeePerson and two derived concrete classes, EmployeeManager and EmployeeStaff, both of which extend the EmployeePerson class. The main program creates objects of type EmployeeManager and EmployeeStaff and prints them.
1. Run the program. The program prints manager and staff data using the EmployeeManager's and EmployeeStaff's printInfo methods. Those classes override EmployeePerson's getAnnualBonus() method but simply return 0.
2. Modify the EmployeeManager and EmployeeStaff getAnnualBonus methods to return the correct bonus rather than just returning 0. A manager's bonus is 10% of the annual salary and a staff's bonus is 7.5% of the annual salary.
Current file: EmployeeMain. java
1
2
3 public static void main(String [] args)
4
5 // Create the objects
6 EmployeeManager managernew EmployeeManager (25);
7 EmployeeStaff stafflnew EmployeeStaff("Michele")
8
9 // Load data into the objects using the Person class's method
10 manager. setData("Michele", "Sales", "03-03-1975", 70000);
11 staffl. setData ("Bob", "Sales", "02-02-1980", 50000);
12
13 // Print the objects
14 manager. printInfo);
15 System. out. println("Annual bonus: " manager. getAnnualBonus)
16 staff1.printInfo);
17 System. out. println("Annual bonus: "+ staff1.getAnnualBonus))
18 }
19 }
20

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, dpinzoner5952
Which of the following commands is more recommended while creating a bot?
Answers: 1
image
Computers and Technology, 22.06.2019 22:10, Metlife
Asequential circuit contains a register of four flip-flops. initially a binary number n (0000 ≤ n ≤ 1100) is stored in the flip-flops. after a single clock pulse is applied to the circuit, the register should contain n + 0011. in other words, the function of the sequential circuit is to add 3 to the contents of a 4-bit register. design and implement this circuit using j-k flip-flops.
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, kierafisher05
What is the most popular genre of video games?
Answers: 1
image
Computers and Technology, 23.06.2019 04:31, tbt81
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
Answers: 1
Do you know the correct answer?
Employees example: Abstract class and interface. The classes below describe an abstract class name...

Questions in other subjects:

Konu
Geography, 25.04.2020 06:49