"For Saurabheights only"

profiledmpiney198x
247f.docx

Question 9.9. (TCO 1) Assuming a class definition of a Cat that has a default constructor and constructor that accepts three string arguments, and the appropriate properties defined, how many objects are created in the code below? 

static void Main(string[] args) {      Cat newCatObject;      Cat newCat = new Cat("Cat", "Lucy", "Persian");      newCatObject = newCat;      newCatObject.CatName = newCat.CatName;  }

(Points : 5)

       2        4        3        1 

Question 10.10. (TCO 8) Briefly describe which elements of a class are named using Camel case rules, and what are the best practices regarding the naming of these elements. (Points : 18)

             

Question 11.11. (TCO 2) Provide an example, which shows the distinction between Encapsulation and Data/Information Hiding in object-oriented programming. (Points : 18)

             

Question 12.12. (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 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; it should calculate the tax on the order and display the final price. (Points : 18)

             

Question 13.13. (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 IPurchaseOrder Interface might be constructed.  (Points : 18)

             

1.

(TCO 2) Keeping in mind all object-oriented programming best practices, create a class for a Bookcase, 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.

Question 2.2. (TCO 3) How does the “is-a” relationship relate to inheritance? Give an example of such a relationship.  (Points : 18)

Question 3.3. (TCO 4) Consider the class Apple. Given your knowledge of some common components of apples    -       show a class hierarchy in which the class Apple inherits from other classes, which, in turn, can also be inherited from yet other classes; -       discuss inheritance from class Apple for other closely related derived classes; and -       discuss the common components of class Apple. (Points : 18)