Main

Showing posts with label cs304. Show all posts
Showing posts with label cs304. Show all posts

Monday, 26 November 2012

CS304 Assignment No.2 (29-11-2012)



Object Oriented Programming (CS304)

Assignment No.2


Deadline

Your assignment must be uploaded before or on 29th November, 2012

 

Solution Coming Soooooooooon.....!


Assignment:
You are required to provide a practical implementation in C++ for the following class diagram. You have to provide the solution in the form of classes in C++.


Class Diagram for Assignment No. 2

Figure 1: Object Model of Property Portal


Detail Description:
You are required to give C++ implementation of following classes:

1.      PropertyPortal
2.      PropertyType
3.      Commercial
4.      Residential

Following is the description of all data member and member functions of respective classes:

v  Data members for PropertyPortal:

o   NoOFUsers: This data member will be used to know the total number of users which visited this site/portal.
o   Name: Property portal will have some name; you can name it as VU-Real-Estate. 
o   UAN: Property portal will have some universal access number such as 111-111-111. 

v  Methods for PropertyPortal:
o   Constructor(s) and destructor.
o   Setter and getter function for NoOFUsers, Name, and UAN data members.
o   getPropertyInfo() will take information about property type, property belongs to which city and all other details which are available in PropertyType class.

v  Data members for PropertyType:
o   City: User will input city in which he/she want to search property details.

v  Methods for PropertyType:
o   Constructor(s) and destructor for class.
o   Setter and getter function for city data member.
o   getPropertyType() will ensure whether property is a commercial property or it is a residential property. A property can’t be both at same time.

v  Data members for Commercial
o   PropertyValue: Will show some fixed value for the commercial property.

v  Methods for Commercial
o   Constructor(s) and destructor for class.
o   Setter and getter function for PropertyValue data member.
o   getPlot() will return a plot number.

v  Data members for Residential
o   PropertyValue:  Will show some fixed value for the Residential property.

v  Methods for Residential
o   Constructor(s) and destructor for class.
o   Setter and getter function for propertyValue data member.
o   getPropertyCategory() This method will check for property category if it is a plot then it will return true else will print an appropriate message.  

Important Points:

  1. You also have to show the relationship (inheritance, association, aggregation, composition) between classes in proper C++ syntax with comments. No marks will be given for incorrect relationship.
  2. Dynamically allocate memory where required.
  3. Implement all member functions of each class. Make sure you use most appropriate return types and signatures for the function.  
  4. Implement constructors of all classes (Overload constructors if required also can use copy constructor if required).


Note: You are required to submit only .cpp file. Word document or any other file format will award you 0 marks straight away.

cs304 quiz # 2 (26-11-2012)


BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     89
sec(s)    
Question # 1 of 10 ( Start time: 09:56:00 PM )     Total Marks: 1
Select correct line of code for aggregation relationship between “Person” class and “Phone” class.
Select correct option:
    class Person { Phone * p; };
    class Phone { Person * p; };
    class Person { Phone p; };
    class Phone { Person p; };

BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     89
sec(s)    
Question # 2 of 10 ( Start time: 09:56:50 PM )     Total Marks: 1
What type of relationship exists between “Account” class and “CurrentAccount” class?
Select correct option:
    Inheritance
    Composition
    Aggregation
    Association

BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     89
sec(s)    
Question # 3 of 10 ( Start time: 09:58:21 PM )     Total Marks: 1
“Person” class is composed off “Nationality” class. What will be the order of execution of destructor of “Keyboard” class and “Keys” class?
Select correct option:
    First Destructor:: Nationality.. Second Destructor:: Person..
    First Destructor:: Person.. Second Destructor:: Nationality..

BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     89
sec(s)    
Question # 4 of 10 ( Start time: 09:59:49 PM )     Total Marks: 1
Select correct line of code for inheritance relationship between “Person” class and “Supervisor” class. “Person” is parent class while “Supervisor” is child class.
Select correct option:
    class Supervisor: public Person
    class Person: public Supervisor
    class Supervisor:: public Person
    class Person:: public Supervisor

BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     89
sec(s)    
Question # 5 of 10 ( Start time: 10:00:08 PM )     Total Marks: 1
Can we access methods of composed object in the same way as we can access methods of other objects?
Select correct option:
    Yes
    No

BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     89
sec(s)    
Question # 6 of 10 ( Start time: 10:00:22 PM )     Total Marks: 1
What type of relationship exists between “SavingAccount” class and “CurrentAccount” class?
Select correct option:
    Both are child classes
    Both contains each other
    Both are composed of each other
    None of the given option

BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     89
sec(s)    
Question # 7 of 10 ( Start time: 10:01:41 PM )     Total Marks: 1
What will be most appropriate C++ data type for variable “InterestRate”?
Select correct option:
    int
    long int
    double
    float

BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     90
sec(s)    
Question # 8 of 10 ( Start time: 10:02:00 PM )     Total Marks: 1
“Account” is parent class while “CurrentAccount” is child class. Can I inherit the constructor of “account” class?
Select correct option:
    Yes
    No

BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     89
sec(s)    
Question # 9 of 10 ( Start time: 10:02:52 PM )     Total Marks: 1
Select correct line of code for inheritance relationship between “Gender” class and “Female” class. “Gender” is parent class while “Female” is child class.
Select correct option:
    class Female: public Gender
    class Gender: public Female
    class Female:: public Gender
    class Gender:: public Female

BC090201078 : Waqas



Quiz Start Time: 09:55 PM    
Time Left     89
sec(s)    
Question # 10 of 10 ( Start time: 10:04:04 PM )     Total Marks: 1
In______________, a pointer or reference to an object is created inside a class.
Select correct option:
    Aggregation
    Composition
    Inheritance
    Association