Objectives: • Inheritance, Abstract Classes, Polymorphism, Interfaces Handling Exceptions and Reading data from Files Fo

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Objectives: • Inheritance, Abstract Classes, Polymorphism, Interfaces Handling Exceptions and Reading data from Files Fo

Post by answerhappygod »

Objectives Inheritance Abstract Classes Polymorphism Interfaces Handling Exceptions And Reading Data From Files Fo 1
Objectives Inheritance Abstract Classes Polymorphism Interfaces Handling Exceptions And Reading Data From Files Fo 1 (56.34 KiB) Viewed 42 times
Objectives Inheritance Abstract Classes Polymorphism Interfaces Handling Exceptions And Reading Data From Files Fo 2
Objectives Inheritance Abstract Classes Polymorphism Interfaces Handling Exceptions And Reading Data From Files Fo 2 (48.63 KiB) Viewed 42 times
Objectives: • Inheritance, Abstract Classes, Polymorphism, Interfaces Handling Exceptions and Reading data from Files For this Assignment, you would download and unzip the Assignment-6 NetBeans project folder posted under the assignment on Blackboard. This NetBeans project includes GradesStatistics.java program that will be modifying in Exercise-3. You will create all the files you need for exercise-1 in the same NetBeans project folder. Exercise: I A company pays its employees on a weekly basis. The employees are of four types: Salaried employees are paid a fixed weekly salary regardless of the number of hours worked, hourly employees are paid by the hour and receive overtime pay (1.5* wage) for all hours worked in excess of 40 hours, commission employees are paid a percentage of their sales and base-commission employees receive a base salary plus a commission based on their gross sales. The company wants to implement a Java application that performs its payroll calculations polymorphically. (50 points) Hint: This programming exercise is similar to the AbstractClassExample posted in Blackboard under chapter 10. SalariedEmployee Employee Class Commission Employee BasePlusCommission Employee Employee hierarchy UML Class diagram HourlyEmployee
1. Write an Abstract Java class-Employee that encapsulates an employee's first name, last name, SSN. Implement the appropriate get and set methods along with toString() method and equals() method. Note: An abstract class is a class that cannot be instantiated. The class is declared as follows: public abstract class Employee Also, provide an abstract method called getEarnings() with a return type of double type. The purpose of the getEarnings() method is to return the earnings that each type of employee makes. Note: an abstract method is a method with no body. Below is it's declaration public abstract double getEarnings ( ) ; 2. Create a lava class-SalariedEmployee which is a special type of Employee with the following additional attribute: weeklySalary. Provide appropriate get, set and equals().toString() methods. Implement a newer version of getEarnings() method that returns the earnings of Salaried Employee: weeklysalary. 3. Create another lava class-HourlyEmployee which is another special type of Employee with the additional attributes: wage and hours. Provide an appropriate set and get methods along with equals(), toString method. Also, implement a newer version of getEarnings() method that reflects earnings of HourlyEmployee. (Note: take into the account the rules for calculating the earnings for the hourly employee as stated earlier in the problem description) 4. Create Java class-CommissionEmployee, another type of employee with attributes: grossSales and commissionate. Provide set, get and equals 1 toString() methods. Provide a newer version of getEarnings() method that returns the eamings as (commission Rate "grossSales). 5. Implement a specialized type of Commission Employee called BasePlusCommission Employee class which has an additional attribute: base salary. Provide get, set and equals().toString() methods. Implement the getEarnings() method that returns the earnings as (commission Rate grossSales) + baseSalary. Note for all the above User-Defined Classes: • Provide appropriate validation code so the right values get populated in the instance variables. For example, the payrate should not be negative. Write a Java application (Client) program with a static method called generateEmployees) that returns a random list of 10 different types of Employee objects. You would use an ArrayList to store the employee objects that will be returned. Use a for loop to populate randomly different types of employee objects with some random data. You could possibly think of a range of values like 1-4. If random value is 1. create a HourlyEmployee object with some randomly generated data, if 2.a SalariedEmployee object with some random data and so on. I would leave it to your ingenuity to generate and populate these different Employee objects with other data like name etc. As these objects are generated, add them to your data structure (array or ArrayList that you are using). Finally, the method returns this ArrayList<Employee In the same application class, implement the main() method. Call the generateEmployees() static method and using a for loop to print the details of each of the employee along with their earnings on the output window. (40 points)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply