Project 1 - A Personal Calendar
Part 1 - Due - Monday, September 20, 2004
Part 2 - Due - Friday, September 24, 2004
The goal of this project is to give you an opportunity to brush up on your programming skills. This project does not require advanced features of C++, but you should use all of the features of C++ that we have discussed so far.
In this project, you will write a program which manages a personal calendar. You calendar should support the following operations:
- Add an appointment - A user must be able to add a new appointment by specifying the month, day, year, and time of the appointment as well as a short description of the meeting.
- Remove an appointment - A user must be able to delete an appointment which has been cancelled.
- View all appointments - A user must be able to view all appointments in her calendar.
- View appointments for a given day - A user must be able to select this option, enter the desired day, and view all appointments for that day.
- Advance day - A user must be able to advance the day. If the user selects this option, she can set the day and the program will remove all appointments which have occurred prior to the present day.
Your program should provide the user with a menu of the four options described above and prompt for a selection. You must ensure that all user input is valid. Once a selection is made, perform the requested action and prompt for another selection.
Implementation Hints
Your program must adhere to the following guidelines unless we have explicitly discussed an alternative.
Your program should define a new structured type which will hold information about a single appointment. This information should minimally include: (1) a short description of the appointment (2) the appointment day (3) the appointment month and (4) the appointment year.
Your program should store the list of appointments in an array. The array must be kept in sorted order. When a new item is added, it should be inserted into the correct position in the array. Following is an example:
Before:
10/4/2004 - 1PM - CS 211 Office Hours
10/5/2004 - 6PM - Dinner with mom
10/22/2004 - 11AM - Midterm exam
Insert: 10/10/2004 - 10AM - Meet with Advisor
Result:
10/4/2004 - 1PM - CS 211 Office Hours
10/5/2004 - 6PM - Dinner with mom
10/10/2004 - 10AM - Meet with Advisor
10/22/2004 - 11AM - Midterm exam
Make sure that when items are inserted and/or removed, the other items in the array are moved accordingly. In other words, if you remove item 0, all other items in the array must be moved down. If you remove item 2, items 3 and up should be moved down to fill in the slot vacated by item 2.
Part 1 - Due Monday, September 20, 2004
For part 1, you must submit the design of your program and algorithms for each piece of your design. This should include headers (including return type and parameters) for all functions you plan to implement and complete algorithms for each function (including main). As an example, one piece of your design should be a function to print all appointments listed in the calendar. You might specify this piece as follows:
function: printAllAppointments
returns: void
parameters: void
side-effects: all appointments displayed on screen
algorithm:
if(number of appointments is 0)
print "No appointments in calendar"
else
for i = 0; i < number of appointments; i++
print month/day/year - time - description
Part 2 - Due Friday, September 24, 2004
- Complete and submit your working code.
- Make sure that each function is well documented. Your documentation should specify the type and function of the input paramaters and ouput.
- Run your program on a variety of inputs ensuring that all error conditions are handled correctly. Copy and paste the output of your test runs to the bottom of your program. Make sure the output is a comment. That means, put a /* before the output and a */ after the output.
- Make sure I have seen your program run. Unless you make alternate arrangements with me prior to the due date, you should demonstrate your program in the lab during 4th hour on the due date.
Reminder: No part of your code may be copied from any other
source. All code submitted must be original code written by you.
Sami Rollins