CS304 - Object Oriented Programming Assignment No. 1 Solution Fall 2018
#1
CS304 - Object Oriented Programming Assignment No. 1 Solution Fall 2018 Due Date: December 07, 2018 


[b]Assignment No. 01 
SEMESTER Fall 2018
CS304 - Object Oriented Programming

Total Marks: 20
Due Date:  07/12/2018
 
Instructions:
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
§  The assignment is submitted after due date.
§  The assignment is submitted via email.
§  The assignment is copied from Internet or from any other student.
§  The submitted assignment does not open or file is corrupt.
§  It is in some format other than .cpp.
 
1)      Note: You are supposed to submit your assignment in .cpp format. Any other formats like scan images, PDF, zip, doc, rar and bmp etc will not be accepted. All types of plagiarism are strictly prohibited.
 
For any query about the assignment, contact at CS304@vu.edu.pk
Objective
The objective of this assignment is:
o   To give you the idea of practical implementation of some concepts like, definition of classes, Data members, member functions, Constructors, Aggregation and Composition etc.
 
For any query about the assignment, contact at cs304@vu.edu.pk
GOOD LUCK!
 
Marks: 20 
 
Problem Statement:
We have the following part of class diagram showing aggregation relationship:
                                    
You are required to implement above class diagram (complete program) in C++ with all data members, constructors, member functions and concept (aggregation) given in the class diagram/table 1.
 
Class Name
Functions

 
Grocery Home
-Default constructor
 

 
Fruit Store
-Default constructor


 
Grocery Store
-Default constructor
 

Dairy Store
-Default constructor
 

Apple
-Default constructor
 

Grapes
-Default constructor
 

Guava
-Default constructor
 

Tetra Milk
-Default constructor
 

Whitener
-Default constructor
 

Cream
-Default constructor
 

Cooking Oil
-Default constructor
 

Rice
-Default constructor
 

Flour
-Default constructor
 

 
 
 
 
 
                                                                           Table 1: Classes
 
Note: You have to submit .CPP file. See the sample Output to view the messages you need to print in constructors of all classes.
Sample Output:
                                                                                 Best of luck!
 
Lectures Covered:  This assignment covers Lecture # 11-15
Deadline:  Your assignment must be uploaded/submitted at or before Due Date 07/12/2018.[/b]
#2
CS304 Assignment Solution

Code:
#include<iostream>
using namespace std;

class Apple{
public:
Apple(){
cout<<"\nApple Constructed called.";
}
};
class Grapes{
public:
Grapes(){
cout<<"\nGrapes Constructed called.";
}
};
class Guava{
public:
Guava(){
cout<<"\nGuava Constructed called.";
}
};

class FruitStore{
private:
Apple a;
Grapes g;
Guava gv;
public:
FruitStore(){
cout<<"\n\nFruitStore Constructed called.\n\n";
}
};
class TetraMilk{
public:
TetraMilk(){
cout<<"\nTetraMilk Constructed called.";
}
};
class Whitener{
public:
Whitener(){
cout<<"\nWhitener Constructed called.";
}
};
class Cream{
public:
Cream(){
cout<<"\nCream Constructed called.";
}
};
class DairyStore{
private:
TetraMilk tm;
Whitener w;
Cream cr;
public:
DairyStore(){
cout<<"\n\nDairyStore Constructed called.\n\n";
}
};

class CookingOil{
public:
CookingOil(){
cout<<"\nCookingoil Constructed called.";
}
};
class Rice{
public:
Rice(){
cout<<"\nRice Constructed called.";
}
};
class Flour{
public:
Flour(){
cout<<"\nFlour Constructed called.";
}
};
class GroceryStore{
private:
CookingOil co;
Rice r;
Flour f;
public:
GroceryStore(){
cout<<"\n\nGroceryStore Constructed Called.\n\n";
}
};

class GroceryHome{
private:
FruitStore fs;
GroceryStore gs;
DairyStore ds;

public:
GroceryHome(){
cout<<"\nGroceryHome Constructed Called.\n\n";
}
};

main(){
GroceryHome h;
}
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  CS301 - Data Structures Assignment No. 1 Solution Fall 2018 mustansar hussain 0 261 12-05-2018, 03:07 PM
Last Post: mustansar hussain
  cs502 assignment 1 autumn 2018 discussion rabia nawaz 2 279 11-29-2018, 06:16 PM
Last Post: rabia nawaz
  CS601 - GDB Solution - Spring 2018 Angry Bird 0 580 08-16-2018, 12:28 AM
Last Post: Angry Bird
  CS304 - GDB Solution Angry Bird 0 163 08-16-2018, 12:26 AM
Last Post: Angry Bird
  CS402 Assignment 3 Solution Spring 2018 Admin 1 2,042 07-30-2018, 11:48 AM
Last Post: Pakistani
  cs402 assignment 3 discussion spring 2018 rabia nawaz 3 1,409 07-30-2018, 11:43 AM
Last Post: Pakistani
  cs 301 assignment 3 solution needed spring 2018 rabia nawaz 2 2,055 07-25-2018, 01:49 PM
Last Post: Admin
  CS402 assignment 2 Soution spring 2018 Syra Younas 4 1,534 05-28-2018, 10:29 PM
Last Post: Admin
  CS402 assignment 2 spring 2018 Washi Khan 2 2,352 05-24-2018, 04:01 PM
Last Post: Syra Younas
  CS601 assignment 1 Soution spring 2018 Syra Younas 1 1,005 05-10-2018, 12:53 PM
Last Post: Pakistani



Users browsing this thread:
1 Guest(s)