Buy Online No Prescription! | Forum Dove Acquistare Il Cialis

Transcript

Buy Online No Prescription! | Forum Dove Acquistare Il Cialis
OOPDA – Employee Lab Part 1
Purpose: To build the first part of a Human Resources application, i.e., the classification of employees.
Learning Objectives:
 Gain experience with String methods;
 Work with polymorphic collections;


Understand how to properly use inheritance;
Apply knowledge of UML.
Instructions:
 You are encouraged to work in pairs for this lab.
 Comment fully with javadoc and produce the HTML output for each class.
 Include full UML class diagrams
Part #1: Employee Class
Design a class named Employee. The class should keep the following information:
 Employee Name (a string)
 Employee identification number (a string) in the format XXX-L, where each X is a digit within the range 0-9 and the L is a
letter within the range ‘A’-‘M’ (both lowercase and uppercase letters are acceptable)
 Hire year (class Calendar)
Write one or more constructors and the appropriate accessor and mutator methods for the class. Also make sure to include
methods equals() and toString(). Make sure that the employee identification number is always validated.
Part #2: Worker Class
Create a class named Worker that extends the Employee class. This class should hold the following information:
 Hourly rate (a double), a positive value between $6.00 and $50
 Number of hours worked this week – a positive integer value between 4 and 80
Write one or more constructors and the appropriate accessor and mutator methods for the class. Also make sure to include
methods equals() and toString(). Make sure that both instance variables are validated.
Part #3: Supervisor Class
A shift supervisor is a salaried employee who supervises a shift. Class Supervisor should contain the following fields and should
inherit from class Employee:
 Yearly salary (a double) a value between $40,000 and $100,000
 Number of times production goals were met this week (a positive integer).
Write one or more constructors and the appropriate accessor and mutator methods for the class. Also make sure to include
methods equals() and toString().Make sure that both instance variables are validated.
Part #4: Testing
Test the implementation of Employee, Worker, and Supervisor classes by writing a program that does the following:
1. Initializes HashSet/ArrayList of 20 employees (objects of classes Worker and Supervisor) to a reasonable but random
values (you may use class Random to generate the values).
2. Displays complete information about each employee in created list/set.
adapted from “Starting out with Java: From Control Structures through Data Structures”
by T. Gaddis and G. Muganda, 2nd Edition.
Page 1 of 2
OOPDA – Employee Lab Part 1
Part #5: SalariedEmployee Class
Create a class that keeps information about salaried employees such as supervisors and managers. This class will store the following
information and extend class Employee:
 Yearly salary (a double). Generally, the value of this instance variable is between $40,000 and $160,000. However the actual
limits on the value are provided by the subclasses (i.e., Supervisor and Manager).
 Deductions (a double) a value between 0.0 and 0.2 – a percentage of the employee payment that goes towards various
deductions such as membership dues.
Part #6: Redesign Supervisor class.
Redesign Supervisor Class so that it extends class SalariedEmployee. Make sure that the yearly salary instance variable in class
SalariedEmployee class is validated according to the Supervisor’s salary range.
Part #7: Manager Class
Create class Manager which extends class SalariedEmployee and contains the following information:
 The name of the department being managed by this employee. Create an enumerated class with the 4-8 different
departments such as Payroll, Production, Accounting, Research, Marketing, etc.
 Number of employees (an integer) – a value between 1 and 100.
 Manager’s salary ranges from $60,000 to $160,000. Make sure that the yearly salary instance variable in class
SalariedEmployee class is validated according to the Manager’s salary range.
Write one or more constructors and the appropriate accessor and mutator methods for the class. Also make sure to include method
toString(). Make sure that the number of employees is validated.
Part #8: Tax Interface
Create interface called Tax which contains the following methods:
 double getTaxRate – returns employee’s tax rate
 double getWeeklySalaryBeforeTaxes – returns employee’s weekly earnings before taxes
 double getWeeklySalaryAfterTaxes – returns employee’s weekly earnings after taxes
 double getWeeklyTaxes – returns the total amount taxes paid this week
Modify classes Worker, Supervisor, and Manager to implement interface Tax. Hint: you might want to change your design to
implement interface Tax for a different set of classes. For your implementation assume the following:
 Regular workers are always taxed at the constant rate of 10%
 Salaried employees are taxed according to the following schedule
o Earnings $40,000 - $60,000: tax rate of 15%
o Earnings $60,001 - $80,000: tax rate of 20%
o Earnings $80,001 - $100,000: tax rate of 25%
o Earnings $100,001 - $125,000: tax rate of 30%
o Earnings above $125,000: tax rate of 35%
 Salaried employees work 52 weeks per year.
Part #9: Testing
Test the implementation of all created classes similarly to that in part #4.
Part #10: Display
Prompt the user for an employee, then display full information about that employee including all methods listed in Part #8.
adapted from “Starting out with Java: From Control Structures through Data Structures”
by T. Gaddis and G. Muganda, 2nd Edition.
Page 2 of 2