Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WRITE IN C!!! a)Write a program which allows a user to maintain a calendar of events in a single day. Your program should allow the

WRITE IN C!!!

a)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.

You do not need to handle an event which starts at midnight and ends at midnight. For example, you do not need to handle "add e1 0 0".

Your program should accept the following commands:

1.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.

2.delete - The delete command deletes an event from the calendar.

3.printcalendar This command prints all of the events in the calendar in order by start time.

4.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

b)Use the gcov utility to determine the line coverage produced by executing the program that you wrote for Problem. Execute the program and supply it with a single input, add e1 7 9. Use gcov to compute the statement coverage and to produce the problem.c.gcov file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions