Question: Class Employee: Create a default class called Employee. An employee should include seven pieces of information as instance variables: 1 . name: the name of

Class Employee: Create a default class called Employee. An employee should include seven pieces of information as instance variables: 1. name: the name of the employee 2. id: an automatically generated string based on the year this employee was hired (4 digits)+ this employee was the __th hire of the year (4 digits). For example, the 15th employee hired in 2020 should be 20200015.3. hireYear: the year that the employee was hired. 4. username: automatically generated string based on the following rules: a. Get the first character of the employees first name b. Get the employees entire last name c. Join them together, and make each character lowercase d. Add a number at the end based on how many existing usernames that are the same to make sure that all usernames are unique For example, if the employees name is David Smith and dsmith,dsmith2, and dsmith3 already exist in the employees csv file, then Davids username should be dsmith4.5. rank: an integer value in the range of 1 to 10 to show this employees level within the company. The higher the number is, the higher rank this employee holds. 6. yearlyPayment: the employees income for this year. 7. department: an object of the class Department. The department the employee works in. Also, create a static variable, called numEmployee, to keep track of the number of employee objects that have been created. Employee records should be stored in a .csv file called employees.csv in the following format: Each row represents an employees information with each column representing different attribute values of the employees, i.e., name, id, username, rank, yearlyPayment, and departments departmentName in this order. Tasks: 1. Add a constructor. The attributes, name, hireYear, yearlyPayment, and rank, must be specified. The attributes, id and username, are generated automatically. The initial value of the attribute, department, should be null. 2. Add a get method for each attribute. 3. Add a set method for the attribute, name. 4. Add a promote() method to promote an employees rank by one. This employees yearlyPayment should also be increased by 10,000 dollars for each promotion. 5. Add a saveRecord() method to save this employees data to the employees.csv file when this employee object is created. 6. Employee objects should be comparable based on their ranks. Implement the Comparable interface. 7. You may add some private utility methods to facilitate your design. Create a class called HourlyPaidEmployee, which is a special type of employee. HourlyPaidEmployees do not get a flat salary. Instead, their annual salaries are calculated based on the number of hours they work. Therefore, this special class should have two additional attributes: 1. hourlyPayRate: hourly pay rate of this employee 2. hoursWorked: how many hours worked so far. Its initial value should be zero. Tasks: 1. Add a constructor. 2. Add a get method for hourlyPayRate and hoursWorked. 3. Add a method called enterHours(int hours) that can add the given hours to the existing number of hours worked so far. The yearlyPayment should be adjusted accordingly. 4. Add a set method for hourlyPayRate that can update this employees hourlyPayRate. Create a class called Executive, which is another special type of employee. Executives have different promotions, which give them additional benefits: Tasks: 1. Add a constructor. 2. The promote() method should also increase an executives rank by one. However, unlike a regular employee, an executives yearlyPayment should be increased by 20,000 dollars for each promotion.

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 Programming Questions!