In a separate file, named HR.java, create a class named HR. It will read in all
ID: 3660057 • Letter: I
Question
In a separate file, named HR.java, create a class named HR. It will read in all personnel info from a file. The first line of the file contains a number indicating how many employees information are specified in the file. And the rest in the file contains information of each individual Employee. The HR class will receive the name of this file through command line argument, create an array to store Employees info, read in the information from the file, and save these Employees' info to another file in a better format via calling the toString method. In addition, it will count how many Employees are with the same title and print out these numbers on the screen.Explanation / Answer
public class Employee { private String fName; private String mName; private String lName; private String ID; private String title; private String startDate; public Employee (String fName1, String mName1, String lName1, String ID1, String title1, String startDate1) { fName = fName1; mName = mName1; lName = lName1; ID = ID1; title = title1; startDate = startDate1; } private String getfName() { return fName; } private String getmName() { return mName; } private String getlName() { return lName; } public void setName (String Name1, String Name2, String Name3) { fName = Name1; mName = Name2; lName = Name3; } private String getID() { return ID; } public void setID (String employeeID) { ID = employeeID; } private String gettitle() { return title; } public void settitle (String employeeTitle) { title = employeeTitle; } private String getstartDate() { return startDate; } public void setstartDate (String employeeStartDate) { startDate = employeeStartDate; } public void print () { System.out.println(fName + mName + lName); System.out.println(ID); System.out.println(title); System.out.println(startDate); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.