#C14558. Attendance Management System Simulation
Attendance Management System Simulation
Attendance Management System Simulation
You are required to implement an attendance management system. The system initially contains two attendance records:
- Employee 1: Date = 2023-10-11, Time = 09:00
- Employee 2: Date = 2023-10-11, Time = 09:05
The system supports the following commands (each command is provided on a separate line after the first input line which contains an integer T indicating the number of commands):p>
- MARK employee_id date time: Add a new attendance record with the given employee_id, date, and time.
- VIEW employee_id: Display all attendance records for the given employee_id in descending order of date (i.e. records with later dates are shown first). If no records exist, output
None
. - EDIT employee_id date new_time admin_flag: Update the time of the attendance record for the given employee_id and date. If
admin_flag
istrue
, then update the record and output "Record Updated" if the record exists; if no matching record is found, output "Record Not Found". Ifadmin_flag
isfalse
, output "Access Denied" and do not update any record. - FILTER start_date end_date: Print all attendance records whose date lies within the inclusive range from
start_date
toend_date
in ascending order of date. If no records are found, outputNone
.
Dates are provided in the format \(YYYY-MM-DD\) (i.e. \(\text{\textbf{\(YYYY-MM-DD\)}}\)).
inputFormat
The first line contains an integer T, denoting the number of commands. Each of the next T lines contains a command in one of the following formats:
MARK employee_id date time
VIEW employee_id
EDIT employee_id date new_time admin_flag
whereadmin_flag
is eithertrue
orfalse
FILTER start_date end_date
All inputs are taken from standard input (stdin).
outputFormat
For each command that requires an output:
- VIEW: Print each matching record on a new line in the format:
employee_id date time
. If no record exists for the given employee, printNone
. - EDIT: Print one line with the result message: either "Record Updated", "Record Not Found", or "Access Denied".
- FILTER: Print each matching record on a new line in the format:
employee_id date time
in ascending order of date. If no records match, printNone
. - MARK: Does not produce any output.
All outputs should be printed to standard output (stdout).
## sample5
VIEW 1
MARK 1 2023-10-12 10:00
VIEW 1
EDIT 1 2023-10-11 09:30 true
VIEW 1
1 2023-10-11 09:00
1 2023-10-12 10:00
1 2023-10-11 09:00
Record Updated
1 2023-10-12 10:00
1 2023-10-11 09:30