Briefly describe any relationships that might exist between


Assignment

Question 1

Two common relationships exist between classes-"is a" and "has a". What kind of concept does each relationship represent? Give real world examples that demonstrate each of the relationships.

Question 2

Given the following program description,

Program Description - You have been asked to create a program designed to keep track of the inventory in a person's house. The program must keep track of all items owned by the house's resident and their specific location in the house. A single room can contain any number of items and every item should have a unique ID to differentiate it from all the other items.

• 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.

Question 3

Define and implement the overloaded constructors that support the following test function for a Date class. The data members for the Date 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
Date 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
}

Question 4

Which of the following statements is/are true?

A. The implementation details of a class can change, so they need to be visible.
B. An object is necessary to be defined before you can create a class.
C. The state of an object is defined as the attributes and behaviors of that object.
D. An interface of a class defines what messages an object can respond to.
All are true
None are true
Only A, C, and D are true

Question 5

Which of the following components of a class definition do not have a return type?

Public member methods
Accessor/mutator methods
Constructors
Private member methods
None of the above

Question 6

_____ enforce a(n) _____ which is a methodology used in object-oriented programming to forces programmers to adhere to certain "rules."

Abstract classes; contract
Static variables; hierarchy
Classes; transitive communication
Method signatures; encapsulation
None of the above

Question 7

Why might it be better to create a derived class instead of adding a few lines of code to an existing Class?

Simplifies testing
No need to re-test the previously written class
Saves time on debugging the program
All of the above
None of the above.

Solution Preview :

Prepared by a verified Expert
Computer Engineering: Briefly describe any relationships that might exist between
Reference No:- TGS02311916

Now Priced at $40 (50% Discount)

Recommended (94%)

Rated (4.6/5)