Sie sind auf Seite 1von 2

Assignment 6 How to start

Clarifications
You do not need to implement all the functions given in the starter code. They are just there for guidance. You may need them, you may not, depends on your implementation. This assignment is open-ended; there is no one set way to do it. You may implement it in ANY way you want as long as you meet the requirements stated in the assignment handout. This gives you a lot of freedom and the opportunity to think and make intelligent decisions. Having gone through four months of C++, you are big kids now and therefore hand-holding in this assignment will be at a minimum. :P You can assume that an Event starts and concludes on the same date. Entire input for Date has to be in one string and in the following format dd/mm/yyyy Entire input for Time has to be in one string and in the following format hh:mm (24 hour format)

Disclaimer: Proceed at your own risk. You have the tools to do this on your own. Reading more is only going to stop you from using your own brain and resorting to following my implementation. :P

Where to Start
The first thing you need to do is to think. Read the assignment carefully, figure out what you need to do, think it through; at the minimum you should have a fair idea of what the end product is even if you dont know how to get there. In summary, you need to make an Organiser that can store Events. The events that you store will simply be objects of an Event class. The objects will have variable objects like Start Date, End Date, Start Time, End Time and variable strings like Description and Location. Your organizer should also have other functionalities that are outlined in the handout but that comes later; first you need to build a very basic framework. There are a multitude of possible implementations and one of those is outlined below:

Implementing the Add Event functionality


Look at the basic framework of your InputValidate class. This class is essentially just functions that are called whenever you require input from the user. The purpose of this class is to ensure that you are receiving valid input. A non-professional implementation of this class has been provided. Feel free to modify it; there are two small errors, one is the use of the equality operator instead of the assignment operator in ReadTime and the second is the inclusion of the cin.ignore() statement in ReadDate.

ReadDate() and ReadTime() are members of this class that can be called statically and they should be called whenever the user wants to add an event. They create a Date and a Time object respectively and return them to the caller. Next are the Date and Time classes. Their constructors and print functions have been given. So far so good, everything has been provided and this is 10% of your assignment all done and you didnt even have to lift a finger. Now starts the work. :P 1. First you need to make your Event Class. The Event Class should have the variables mentioned above. It should have a constructor and it should have a print function. 2. Next you need to make your Schedule Class. This Class need only have one variable; a vector or dynamic array of Event objects. It should have a constructor, an add event function that takes as input an Event and adds it into the vector variable and a print function that takes as input a Date and prints all Events that occur on that date. 3. Next and last is the Organiser class. You need to add a private member variable here an object of the Schedule class. Next you complete the member function DoAddCommand(). This function calls the ReadDate(), ReadTime(), ReadLine() functions and uses the input to create an Event. The event is then passed to the add event function of the schedule class. That function adds it to the vector that is already a member variable and voila you are done with 40% of your assignment. This should hardly take an hour assuming you know your syntax. Three steps, six functions, thats all. Whats all the fuss about? :P

Make sure that you follow all the coding protocols, e.g. all variables should be private. Otherwise, you will be down-marked. This is more than enough to get you started. When you are done you will have your basic structure. All you need to do is to add functionalities one at a time and introduce inheritance to the schedule class.

Das könnte Ihnen auch gefallen