Question: Object-Oriented Programming (Java). Help please? Staff Member -firstName: String -lastName: String -deptNumber: String -hours Worked: double +display():void Manager -bonus: double +display():void SalesRep -allowance: double +display():void

Object-Oriented Programming (Java). Help please?

Object-Oriented Programming (Java). Help please? Staff Member -firstName: String -lastName: String -deptNumber:

String -hours Worked: double +display():void Manager -bonus: double +display():void SalesRep -allowance: double

Staff Member -firstName: String -lastName: String -deptNumber: String -hours Worked: double +display():void Manager -bonus: double +display():void SalesRep -allowance: double +display():void 1) Implement each of the classes in the UML diagram above the relationship and access specifiers must be maintained). Write a primary constructor, setters and getters (Encapsulation) for each of the three classes. The display () method in each class must output/display the value of all the attributes including those inherited). Note: write your name and id number at the top of each file as comments. 2) Create a file called Tester for testing the functionality of your application. 3) Within the Tester file create an object of the base class called StaffMember using the primary constructor, then call the object's display() method. 4) Create a list of 5 SalesRep using an array list. 5) Use an iterator to display the contents of the list created above. 6) Within the Tester file demonstrate polymorphism using all the classes in the UML diagram. When your program runs there should be evidence to show that polymorphism has occurred. 7) Create an abstract method called calculate Salary() in the base class. This method should calculate and display the salary for each staff member, as well as their firstname, lastName and DeptNumber. After doing this it will cause errors to appear in your program when you try to run it. For a Manager, salary = ((hours Worked * 2500) + bonus). For a Sales Rep, salary = ((hours Worked * 1500) + allowance). 8) Use the calculateSalarymethod to display the salary for a sales Rep and a Manager in the tester file you created above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!