Question: To add an employee Add an exception handler for every modifier if the opposite value is entered like int instead of String. (String)Employee name; (int)Employee
To add an employee
Add an exception handler for every modifier if the opposite value is entered like int
instead of String.
(String)Employee name;
(int)Employee age;
(String)Employee email;
(int)Employee position;
(int)Employee ID;
(float)Employee salary;
(long)Employee contact;
To view details of an employee
Implement getInfo() method;
Ask user to enter details of employee
If the file does not exist throw exception FileNotFoundException:
To remove file info of an employee
Implement method removeFile(int ID).
Create a file when each employee information is entered by the user with the
name of employee ID (file + ID + .txt). Each employee information should
be saved into a file directly.
If the employee file exists(file.exists) delete employee. Remove the txt file.
Print message: System.out.println(" Employee has been removed Successfully");
2
d. else: System.out.println(" Employee does not exists :( ");
To update file info of an employee
Press to update Employee details.
Enter the ID of the employee which you want to update.
Print the employee information from the file on the screen.
Then ask user:
Please Enter the detail you want to Update : For example:
want to Change the Name, then Enter Current Name and Press Then write the new Name then Press Enter. It will Update the
Enter the Updated Info :Name
To exit the Portal.
a. Press to exit, print message: System.out.println(" Thank You For Sharing your details :));
7. In order to continue add Press Enter to Continue each time
Files to Create: Here is some information about creating classes and objects. Use the same logic for other classes too and try to brainstorm.
1. EmployManagementSystem
a. Create 5 Switch Cases
Case 1 -> Create file Case 2 -> Enter employee ID, view file. Case 3 -> Enter employee ID (To remove) Case 4 -> Update employee. If the employee file ID does not exist, throw an exception. Case 5 -> CodeExit.
2. Employee_Add
Usage in EmployManagementSystem class: Employee_Add ep =new Employee_Add(); ep.createFile();
If you Enter. Name. >>name Please
3
Employee_Remove implements Remove
Employee_Show
Employee_Update
EmployDetail(abstract class)
a. 1 inheritor -> Employee_Add class. b. usage in Employee_Add class.
EmployDetail emp = new EmployDetail()
MainMenu(each time user Presses enter to continue go to MainMenu.)
a. public void menu() -> 5 usages in EmployManagementSystem
MainMenu obj1 = new MainMenu(); obj1.menu();
CodeExit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
