CSE 101 -- Prog 1
Due before midnight, Sunday, October 17, 2021.
Late submissions will not be accepted/graded.
Changelog:
- Oct 13, 2021: Updated MERGE error message condition for trying to merge an agenda to itself
- Oct 06, 2021: Updated Makefile to ensure compilation uses c99 standard
Objectives:
Implement List ADT and an event managing application with lists.
Description:
Your goal is to implement the list ADT and to create an application which utilizes
your implementation. The application should be capable of managing two different agendas.
The agendas are lists of events maintained in sorted order.
Details:
-
Similar to Hwk1, input will be from stdin and output will be to stdout.
You can assume that inputs are syntactically well formed, however invalid commands may be given.
For example, you may be given a command to delete an event that is not in the specified agenda.
-
List ADT:
Lists are typically implemented as arrays or linked lists.
Your program will use a linked list implementation.
Your List ADT will support lists of events. Events are structs
containing a name and a start time.
You are provided with List.h.
The first requirement of this program is to
write List.c that implements the functions in List.h.
-
Managing the agendas:
You will use your List implementation to build an application that manages two separate agendas. Build this
application in agendaManager.c. Your application must support the following inputs:
- ADD "<AGENDA_NAME>" "<EVENT_NAME>" <START_TIME>
- Adds an event starting at the specified time to the agenda
- The event should be placed so that it maintains sorted order
- IF there is a free slot for an agenda, and the agenda name doesn't exist, it should create the agenda
- IF there is no free slot for the agenda, and the agenda name doesn't exist, it should print "ERROR: Agenda not found"
- Prints "ERROR: Already an event at that time" when there are conflicting start times
- Prints "ERROR: Already an event with that name" when attempting to add an event with a duplicate name
- IF there is a duplicate name and time, the name error should be printed, and the time error can be ignored.
- DEL "<AGENDA_NAME>" "<EVENT_NAME>"
- Deletes an event from the specified agenda
- Prints "ERROR: Agenda not found" if there is no agenda by that name
- Prints "ERROR: Event not found" if there is no event by that name within the specified agenda
- SWAP "<AGENDA_NAME>" "<EVENT_NAME_1>" "<EVENT_NAME_2>"
- Swaps the start times of 2 events in an agenda
- Prints "ERROR: Agenda not found" if there is no agenda by that name
- Prints "ERROR: Event not found" if either of the events is not contained in the agenda
- PRINT "<AGENDA_NAME>"
- Prints the agenda to stdout
- Events should be printed in order of their start time, earliest to latest
- Time format will be a 24 hour clock. i.e. 9AM = 09:00, 9PM = 21:00
- Prints "ERROR: Agenda not found" if there is no agenda by that name
- Output should be in the following format:
======== <AGENDA_NAME> ========
<START_TIME> <EVENT_NAME>
<START_TIME> <EVENT_NAME>
<START_TIME> <EVENT_NAME>
===== END OF <AGENDA_NAME> =====
- MERGE "<AGENDA_NAME_1>" "<AGENDA_NAME2>"
- Combines the two agendas, storing the result at <AGENDA_NAME_1>
- Frees <AGENDA_NAME2> to accept another agenda from input
- Assumes the agendas are both in sorted order
- Prints "ERROR: Cannot merge same agenda" if the same valid agenda is passed in twice
- Prints "ERROR: Agenda not found" if one of the agendas does not exist
- Prints "ERROR: Cannot merge: Conflict found." if merging the agendas would create a conflict (time or name)
Here are some simplifying assumptions:
- Each error should be printed on a separate line, in the order that they occur
- No NULL values will be passed as data
- All strings will contain ASCII characters only
- Input will use correct syntax
- Time will be passed in as an integer in the range [0,23]
- Each event will run for exactly one hour
- Agenda names will be unique
- No more than 2 agendas will have to be managed at the same time
Sample input is provided in test.in. The output for this input should
match test.expected.
-
Files for this program:
The following files are provided to you, and should all be submitted
with your work.
-
Makefile: You can edit to change compilers and flags. Running make should
produce an executable called prog1
-
List.h: You don't touch this file. It has a list of
functions that you need to implement for the List ADT.
-
List.c: This is where you define the ListObj struct
and write your linked list implementation for the List ADT.
-
agendaManager.c: This is where you write the application code
to manage two agendas (lists of events).
Grading:
-
Rubric:
You start off with 100 points.
You lose credit for missing functionality, incorrect results,
poorly documented or formatted code, or not following instructions.
Particularly:
- test cases 30 - we have 12 test cases each has 2.5 points
- unit tests: 50 points for proper implementation of linked list ADT
- style and commenting 20 points
Below is a partial list:
- up to 10 points off for inadequate comments or hard-to-read code
- up to 10 points off for not following instructions
- up to 10 points off for special handling to grade your homework (usually
because you did not check that it runs on the computers in the lab first).
- functionality points depending on importance
Make sure you:
a. include a makefile, .c files, and .h file
b. generate an executable file called prog1 with your makefile
c. have confirmed that it compiles and runs properly on unix.ic.ucsc.edu
d. followed the general instructions described in overview.html
-
Who graded your assignment based on your CRUZID first letter :
jay: a* - kk*
nick: kk* - z*
Submission:
Make sure that you've compiled and tested your code on the campus
unix timeshare before submitting.
On the unix timeshare,
put materials in a folder named prog1 and zip it up.
submit cse101-ap.f21 prog1 prog1.zip
You can submit as often as you want up until the deadline.
We will only look at your most recent submission.
After each submission, you should get a message like:
Submitting the files you specified...
copying XXX
1 File submitted:
XXX (revision 2)
where XXX is the material you submitted.
Read the
for instructions on how to submit your work.
Last modified
Saturday, 30-Oct-2021 21:46:55 PDT.