Question
Program in C language. Write a program which allows a user to maintain a calendar of events in a single day. Your program should allow
Program in C language.
Write a program which allows a user to maintain a calendar of events in a single day. Your program should allow the user to enter a series of commands which modify and display the calendar. Your program should print out a prompt to indicate that the user can enter a command. Your prompt should be the string $ . At the prompt the user will type a command followed by a set of arguments for the command. When the user enters a command, your program should respond to the command appropriately and then print another prompt to indicate to the user that he/she can enter a new command. This should continue until the user enters quit which should cause your program to end. Your program should accept the following commands:
add - The add command adds a new event into the calendar. is the name of the event. is the start time of the event. is the end time of the event. may not contain blank space characters. and must be integers between 0 and 23 to indicate an hour on a 24 hour clock. If the time of the new event overlaps with the time of an existing event, the new event should not be added and the message Event overlap error should be printed.
delete - The delete command deletes an event from the calendar.
printcalendar This command prints all of the events in the calendar in order by start time.
quit This command ends your program The following is an example of the execution of the calendar program. User inputs are highlighted in bold.
$ add e1 7 9
$ add e2 3 5
$ printcalendar
e2 3 5
e1 7 9
$ add e3 4 6
Event overlap error
$ delete e1
$ printcalendar
e2 3 5
$ quit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started