Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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?
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 calculateSalaryin 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 aboveStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started