Zoom
3 of 4
Paper No: 1
void update(Employee e)
List Employee> listAll()

List<Employee> sortByName()
4. Class Q1
Build a program that reads an input file and writes the results to an output file following these rules:
Input:
The input is stored in the input.txt text file.

The first line contains a positive integer T (1≤T≤ 100), which represents the number of test
cases.
• Each of the next T lines contains one of the following four types of commands:
Output:
1. Add id name salary department adds a new employee.
2. Update id name salary department - updates an employee based on the given
ID.
3. Print
4. Sort
5. Clear
-
displays the list of employees.
sorts the employee list by name.
remove all employees and print "Cleared employee list."
All results must be written to the output.txt file.
Sample Input 1
input.txt
2
Add 1 Alice 1500.00 HR
Print
output.txt
Added:
1-Alice-1500.00-HR
Employees:
1-Alice-1500.00-HR
Sample Input 2
input.txt
5
Add 1 Alice 1500.00 HR
output.txt
Added:
1-Alice-1500.00-HR
+ 100%
Close