1. 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? 2. Explain the terms Encapsulation and Data/Information Hiding in object-orienProTutor11
1. 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?
2. Explain the terms Encapsulation and Data/Information Hiding in object-oriented programming. How do they differ?
3. 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.
4. Briefly describe what an Interface is and how it can be used in an object-oriented program. Provide example pseudocode showing how an ICountry Interface might be constructed.
5. Keeping in mind all object-oriented programming best practices, create a class for a Chair, with the following specifications:
1) Specify two data members
2) Default Constructor
3) Overloaded Constructor which takes both data member values as input.
4) Generate a unique identification number for each object instantiated from this class. Use a static data member to keep track of the identification number last assigned to an object so that duplications will not occur. Code the necessary portion of the class definition so as to support this requirement.
5) Show a statement which instantiates an object of this class using the overloaded constructor.
You do not need to provide any accessor/mutator methods or other methods.
6) How does the “is-a” relationship relate to inheritance? Give an example of such a relationship.
7.) 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.
- 6 years ago
Purchase the answer to view it