View the step-by-step solution to:

Failure to do so will negatively impact your grade. When overriding methods, always try to call the superclass method from the overridden subclass...

It is a java project to be done using BlueJ. It will need it to be done in a simple format, no special extra code or touch ups. Thanks.

Assignment 3 specification – Inheritance, Polymorphism and Abstraction This overall assignment is worth 25% of your continuous assessment for Algorithms. Please adhere to the naming standards for classes and methods detailed in this assignment specification. Failure to do so will negatively impact your grade. When overriding methods, always try to call the superclass method from the overridden subclass method and then specialise the subclass method. Phase 1 – Inheritance and Polymorphism (15 marks of the overall 25): Create the following inheritance hierarchy in Java that defines the following types of Employee (i.e. its subclasses): HourlyWorker – for employees earning their salary on an hourly basis Manager – for employees that automatically get a managerial bonus on top of their regular salary PermanentEmployee – for employees that get a performance bonus on top of their regular salary The following rules should be applied to this hierarchy: The fields common for all type of Employee include first name, last name and hourly rate. The hourly rate must be greater than zero, otherwise set the rate to zero and print out an error message to the terminal window. If a value is already stored in the hourly rate, do not overwrite it with a zero. In addition, there will be a CONSTANT field that will store the number of hours considered a normal working week (NORMAL_WORKWEEK). The code for creating this constant field is as follows: final static double NORMAL_WORKWEEK = 37.5; The Manager subclass should have a field for the manager bonus. This manager bonus must be greater than or equal to zero, otherwise set the value to zero and print out an error message to the terminal window. If a value is already stored in the manager bonus, do not overwrite it with a zero. The PermanentEmployee subclass should have a field to store their performance bonus percentage. This bonus percentage must be greater than or equal to zero, otherwise set the value to zero and print out an error message to the terminal window. If a value is already stored in the performance bonus, do not overwrite it with a zero. Where required, subclasses of Employee should override the superclass method double calculateSalary(double numHours) , in order to calculate the salary based on the different rules defined for each type of employee (see below). The Employee class should have a void printState() method that formats the printing of the object state to the terminal window. The subclasses for Manager and PermanentEmployee should override the superclass method void printState() so that they can report on the new fields defined in these subclasses. Each class in the hierarchy should define a constructor that initialises each instance variable based on user input data. Each class should also define accessors and mutators for each instance field. The rules for calculating the weekly salary [ double calculateSalary(double numHours) ] of each Employee are: The numHours passed in as a parameter must be greater than or equal to zero. If the numHours is not greater than or equal to zero, return 0.0 and print an error message to the terminal window. Employee – An employee is paid by the hour at a fixed hourly rate.
Background image of page 1
HourlyWorker – An hourly worker is paid for each hour they have worked in the current week, based on a fixed rate per hour. Manager – A manager is paid by the hour at a fixed hourly rate. In addition, the manager always receives a fixed manager bonus. This figure is added directly to their salary. PermanentEmployee – A permanent employee is also paid by the hour at a fixed hourly rate. However, their bonus is calculated differently to the managers. The permanent employee may or may not qualify for a bonus. If they do not qualify for a bonus, their performance bonus percentage is zero. If they do qualify for a bonus their performance bonus percentage must be greater than zero but less than 5 (if an incorrect value for the bonus percentage was entered, set the percentage to 0.0 and print an error message to the terminal window). The bonus is calculated on their salary and added to it. NOTE: The rules for calculating the overtime are the exact same for each Employee; for each hour worked overtime during the week, the hourly rate is doubled. The overtime calculation must be done in a private method in the Employee class, double calculateOvertime (double numHours) and must be called in the double calculateSalary method(double numHours) method. Please submit the completed version of assignment3 into its associated assignment dropbox in Moodle by the specified date. Phase 2 – Testing & Additional functionality (10 marks of the overall 25) Create a driver class called HR that uses the ACM to interact with the user. The HR class should create an ArrayList of Employees, this would be populated with different types of the Employee class, for example some managers, some permanent employees and some hourly employees. The system should allow the user to add a new employee of any type, calculate salaries, and print employee details. Create appropriate test classes for this assignment. Ensure that you test for both valid and invalid data entry. Investigate further the Java library detailing functions available to you through junit.
Background image of page 2

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question