For this assignment you will apply what you have learned to build an application to maintain a personal appointment calendar.
You should work in your groups (2 members). If your partner is not present in class each will need to complete the assignment on your own by the due date/time.
- Deitel’s book.
- This assignment grade sheet for this lab already printed out.
- USB Flash drive(s) or other storage media.
- Your laptop with Microsoft Visual Studio 2015.
Information about each event on the calendar will be held in an object of type Event. The constructor will accept integer values for month, day, year, starting hour, starting minute, ending hour, ending minute, and event title. We assume that the start time and the stop time are both on the same day. Save the start time and the stop time as private DateTime values, and provide a public read-only property for each. Save the event title as a private string value, and provide a read-only property. Override all three of the standard methods inherited from the Object class. For the ToString method, the string returned should be in the following format: “yyyy-mm-dd hh:mm”. Decide for yourself a reasonable interpretation of when two events are equal.
The start time must proceed the stop time, and the event title cannot be empty. If either of these constraints is not satisfied, an exception should be thrown with a clear message indicating the problem.
I suggest that you set the Font property for the form to be 10-point before adding any controls. That then becomes the default for controls on the form. Be sure to set the Sorted property of the list box equal to true. The Delete button is initially disabled and becomes enabled when an event is selected from the list box. When the Delete button is clicked, the selected event is removed from the list box, all text boxes are cleared, and the Delete button is again disabled.
Each entry in the list box is an Event object. The values from that Event object should be used to fill the text boxes in the format shown. (This is pretty easy if you take advantages of the features of the DateTime class, so check out the documentation.)
Add a new form to your project called EventForm. This is an example showing the format of this form:
This form is displayed when the user wants to add an event to the calendar. Set the AcceptButton property for the form to be the Add button, and set the CancelButton property of the form to be your Cancel button. For this form, you will want a private static variable of type list box that will refer to the list box of the main form. You will also want a static property that sets/gets that value. Now go back to the main form and add a line in the Load event that saves a reference to the list box in the EventForm class.
For each of the six combo controls on this form, set the type to be DropDownList. This will prevent the user from trying to type in an invalid hour or minute value. The valid hour values are integers from 1 to 12. The minute values are 00, 15, 30, 45. There is also the ability to select AM or PM.
The Load method for this form should restrict the calendar so that the earliest valid date is the current date (i.e. the date the program is being run) and the latest possible date is December 31 of the current year. It should also set a default value for each of the combo boxes.
Add a private Event variable to the form to represent the newly created event, and define a read-only property for this value. If the user clicks Cancel on this form, the event variable should be null and no event should be added to the list box.
When the Add button is clicked, an Event object is created using the data from the form. Any exception is caught and handled properly. In addition, go through the events in the list box to be sure that the new event doesn’t have a time conflict with some event that already exists. For this, you might use a statement like the following:
foreach (Event otherEvent in m_EventList.Items)
When you have fully debugged your code, upload compressed solution folder to Canvas. Each group member should upload the solution and provide their own grade sheet for this project.
Each of your source files should contain a documentation header with description, author name, class information. Each function should have a documentation header with minimally function name, description, parameters, return value. Use proper program style at all times which means indentation, alignment, and whitespace. Utilize self-documenting code which means use mnemonic, i.e., meaningful variable/function/namespace/class names, etc.
Submit compressed (.zip) solution folder via Canvas.
In your solution folder make sure that all necessary files to compile/link/execute your projects are provided.
Here are some files that may be required
- All required C# source files (.cs)
- makefile (if the solution requires it)
- The entire Visual Studio 2015 solution folder (if the solution requires it)