#K73597. Employee Manager System
Employee Manager System
Employee Manager System
You are required to implement an employee management system. In this system, you will process commands that allow you to add, remove, and search employee records. Each command is provided as a separate line through standard input (stdin). The commands are as follows:
- ADD <employee_id> <first_name> <last_name> <department>: Add a new employee record.
- REMOVE <employee_id>: Remove the employee record with the given employee_id.
- SEARCH <department>: Search for all employees belonging to the specified department and print the results. Each matching record should be printed as "employee_id first_name last_name" on separate lines. If no employee is found in that department, print "No employees found in <department>".
- END: Terminate the input processing.
The output should be printed to standard output (stdout). Note that there may be multiple SEARCH commands and their corresponding outputs should appear in the same order as they were processed.
If you need to include any formulas in your explanation, use LaTeX format. For example, to show an equation, you can write: \(E = mc^2\).
inputFormat
The input is provided via the standard input. Each line is a command. You will continue reading commands until the "END" command is encountered.
Example input:
ADD 1 John Doe Sales ADD 2 Jane Smith Engineering ADD 3 Alice Brown Sales REMOVE 2 SEARCH Sales SEARCH Engineering ADD 4 Bob White Sales SEARCH Sales END
outputFormat
The output is written to the standard output. For each SEARCH command processed, print the result as follows:
- If one or more employees exist in the department, print each matching record on a new line in the format:
employee_id first_name last_name
. - If no employee is found, print:
No employees found in <department>
.
Each SEARCH command result should appear in the order of processing and separated by a newline.
## sampleADD 1 John Doe Sales
ADD 2 Jane Smith Engineering
ADD 3 Alice Brown Sales
REMOVE 2
SEARCH Sales
SEARCH Engineering
ADD 4 Bob White Sales
SEARCH Sales
END
1 John Doe
3 Alice Brown
No employees found in Engineering
1 John Doe
3 Alice Brown
4 Bob White
</p>