Expert Answers

1. (TCO 2) Given the following program description,

identify the required classes/objects necessary to achieve the program requirements;
briefly describe any relationships that might exist between your classes; and
briefly describe the overall hierarchy of your proposed classes.

Program Description – You have been asked to create a program designed to take coffee orders in a coffee shop. The program must be able to take an order, assign a unique ID to the order, add any number of drinks to the order and calculate the total bill. (Points : 18)
2. (TCO 7) Briefly describe what an Interface is and how it can be used in an object-oriented program. Provide example pseudocode showing how an iChef Interface might be constructed. (Points : 18)

3. (TCO 4) Consider the class Triangle. Given your knowledge of some common components of triangles

– show a class hierarchy in which the class Triangle inherits from other classes, which, in turn, can also be inherited from yet other classes;
– discuss inheritance from class Triangle for other closely related derived classes; and
discuss the common components of class Triangle. (Points : 18)

4. (TCO 3) How does the “has-a” relationship relate to composition? Give an example of such a relationship. (Points : 18)

5. (TCO 2) Manager is a class that is derived from the Employee class. The Employee class has two data members that represent the name and age. The Manager class has an ID as well. Each of the two classes has a member function named printData(). Write the class descriptions for each of the two classes with the appropriate constructors and access specifiers using appropriate naming conventions and data types. Do not write the function implementation. (Points : 18)
6. (TCO 2) Define and implement the overloaded constructors that support the following test function for a Time class. The data members for the Time class are hour, minute, and second. All are integer data types.
7. (TCO 8) If you were a manager and wanted to address best practices in choosing appropriate names for attributes and their associated accessor/mutator properties, what would you say? (Points : 22)