Part 3

Part 3.

1.(TCO 8) You are a manager who is employed by a game production company. Your team is responsible for coding one of the game modules. You have two newly hired programmers working for you who believe that the following naming conventions and properly chosen names for methods is too restrictive since each person has his own style and it should be skipped. How would you explain to them what the best practices for naming methods is and why it is so necessary?

2. Provide an example that shows how we can have Encapsulation without Data/Information Hiding in object-oriented programming.

3. Given the following program description.

Identify the required classes/objects necessay to achieve the program requirements

Briefly describe any relationships that might exist between your classes; and

Briefly decribe the overall hierarchy of your proposed classes.

Program Description – You have been asked to create a program designed to ring up orders in any store. The program must create a new electronic “shopping cart” with a unique ID that can be associated with a specific customer. The shopping cart must accept any number of items including both taxable and non-taxable items, and it should calculate the tax on the order and display the final price.

4. How are pure virtual functions created? When a class contains one pure virtual function, what will happen? Can we still treat the class like a normal class?

5. Consider the class Bicycle. Given your knowledge of some common components of bicycles

Show a class hierarchy in which the class bicycle inherits from other classes, which, in turn, can aslo be inherited from yet other classes;

Discuss inheritance from class bicycle from other closely related derived classes; and

Discuss the common components of class bicycle.

6. How does the “is-a” relationship relate to inheritance? Give an example of such a relationship.

7.define and implement the overload constructors that support the following test function for a Date class. The data members for the Data class are:

Year – integer number

Month – integer number

Day – integer number

     ----int main()

{ Date d1() ;  //d1 will take all default values

Date d2 (2011, 8, 2) ; //d2 will take all supplied values

Dates d3 (2011) ; //d3 will take supplied year, month and day will take default values

Date d4 (2011, 9) ;  //d4 will take supplied year and month, day will take default value

Date d5 = d2;  // d5 will take the same value as d2

// the rest of the code

}

 
Powered by