Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a class named Yourlastname_Yourfirstname_hw5. Add the following default classes below this Yourlastname_Yourfirstname_hw5.class: Class Employee: Create a default class called Employee. An employee should
Create a class named Yourlastname_Yourfirstname_hw5. Add the following default classes below this Yourlastname_Yourfirstname_hw5.class: 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 employee's first name b. Get the employee's 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 employee's name is David Smith and "dsmith", "dsmith2", and "dsmith3" already exist in the employees csv file, then David's username should be "dsmith4." 5. rank: an integer value in the range of 1 to 10 to show this employee's level within the company. The higher the number is, the higher rank this employee holds. 6. yearlyPayment: the employee's 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 employee's information with each column representing different attribute values of the employees, i.e, name, id, username, rank, yearlyPayment, and department's departmentName in this order.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Here is the required program using Java programming language import javaio import javautil public class YourlastnameYourfirstnamehw5 public static void mainString args Department department1 new Depar...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