c++ exercise 5 SolutionTopsolutions
A catering company provides prepared meals for events such as business meetings. The company has a number of standard meals, which it identifies with a unique integer ID number. At this stage each meal also has just a cost in £ and each event is characterised by a list of the meals the company must prepare for it. However, more characteristics may be added to either object in the future.
The company desires that you develop a basic software package that it will be able to use in order to manage its business efficiently and which it intends will be expanded in the future.
part 1 (40%)
Your first task is to develop the basic meal and event classes. Please provide just the minimum functionality expected of any well designed class. Please make any required design decisions in the context of the project described above and in accordance with good software engineering practice.
part 2 (10%)
Provide stream operators for both the meal and event classes. Examination part 3 (10%)
Add to the event class two member functions that return its most expensive meal and the total cost of all the meals.
part 4 (20%)
Write a main program that first reads all available meals from a file called menu.txt. Write a function called create_event. This function is be called if a customer of the
company wants to book an event.
The function is to show the customer the details of all the available meals and then ask the customer to enter which meals they wish to select. Once complete, the function is to return a dynamically created event object.
Note well, the customer must be allowed to choose to abort the process within the function in which case consider carefully the return value of the function.
Finally the main program is to print to screen the total cost of the event.
Note well, the formatting and creation of an example of the file menu.txt is yourresponsibility.
To provide for future expansion, it is now considered appropriate to generalise to the concept of a event.
All events, of whatever sub-category, are to contain the member variables and functions described above.
A particular sub-category of event is to be weekend_event. The price of all meals for a weekend_event is to be x% higher than the usual prices given above in the menu.txt file of task 4 for example. Each weekend_event can have a different value of x.
Please modify your basic class declaration and definition code (not the full code of task 4) to reflect the relationship between event and weekend_event.
In particular, ensure that the functionality of task 3 gives the correct costs when called through an event pointer.
- 7 years ago
Purchase the answer to view it
- NOT RATED
A catering company provides prepared meals for events such as business meetings. The company has a number of standard meals, which it identifies with a unique integer ID number. At this stage each …5 years ago