Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Problem Statement:

 

In continuation of the assignment no. 1, consider the following class diagram (a part from Assignment no. 1 solution), detailed description of the diagram is given in the table.

                       

 

Table:

 

Class Name

Attribute Name

Attribute Data Type

Behavior (Functions)

Company

Comp_Name

Character Pointer

- Default Constructor

        - Profit_Report()

        - Financial_Statement()  

Registration_No

Character Pointer

Transport

Weight

Integer

 

-          Default Constructor

-          Carray_Goods()

Capacity

Integer

Speed

Integer

Land_Transport

Transportation_Mode

Character Pointer

 

-          Default Constructor

Vehicle_Type

Character Pointer

Air_Transport

Aircraft_Type

Character Pointer

 

-          Default Constructor

Aircraft_Name

Character Pointer

 

Length

Integer

 

Room

Width

Integer

 

-          Default Constructor

-           Store()

 

 

 

 

Hall

             Length

Integer

-          Default Constructor

-          Store()

Width

Integer

 

 

 

 

 

You are required to map (implement/Code) this class diagram into C++.

Make sure that your solution must contain ONLY classes’ definitions given in the diagram, definitions of all attributes and proper declaration and definitions of member functions including constructors that are given in the above table.

 

Detail of some Member Functions:

 

Profit_ Report( ):              This function prints the annual profit of the company.

Financial_Statement( ):   This function prints the annual financial statement of the company.

Carry_Good( ):                Each transport has carrying goods functionality.

 

Note:  

  1. The body of all member functions should be empty, while the constructors should have code which initializes the objects.
  2. In main function you may print a simple “cout” statement in order to check your program for syntax errors.
  3. You must also implement inheritance and aggregation.

 

Lectures Covered:  This assignment covers Lecture #    07-10

Deadline:         Your assignment must be uploaded/submitted at or before. May 20, 2014

 

Views: 10599

Attachments:

Replies to This Discussion

#include<iostream.h> #include<conio.h>    // company Class//  class Company{  // Data Member Defination//                  private:                  char* Comp_Name;                  char* Registration_No;  // Member Function Declaration//                  public:                                  Company();                                  Company(char* Comp_Name,char* Registration_No);                                   void Profit_report();                                   void Financial_Statement();                                  ~Company();  };  // Transport Class//  class Transport{  // Data Member Defination//                  private:                                  int Weight;                                  int Capacity;                                  int Speed;    // Member Function Declaration//                  public:                                  Transport();                                  Transport(int Weight,int Capacity,int Speed);                                  void Carry_Goods();                                  ~Transport();  };  // Land_Transport Class  class Land_Transport{  // Data Member Definaion                  private:                                  char* Transportation_Mode;                                 char* Vehical_Type;  // Member Function Declaration//                  public:                                                                      Land_Transport();                                 Land_Transport(char* Transportation_Mode,char* Vehical_Type);                                  ~Land_Transport();  };  //Air_Transport class//  class Air_Transport{  // Data Member Function//                  private:                                  char* Aircraft_Type;                                  char* Aircraft_Name;                   public:                                  Air_Transport();                                  Air_Transport( char* Aircraft_Type,char* Aircraft_Name);                                    ~Air_Transport();  };  //Class Room//  class Room{                  private:                                  int Length;                                  int Width;                  public:                                  Room();                                  Room(int Length,int Width);                                  void Store();                                  ~Room();  };  //Class Hall//  class Hall{                  private:                                   int Length;                                  int Width;                  public:                                  Hall();                                  Hall(int Length, int Width);                                 void Store();                                 ~Hall(); };  int main() {     cout"Program Working";          getch();     return 0; }

yei to sahe compile hi nahe hova error aa raha hai...!!

 mc110400860 u hv 2 errors...

in 1st line remove .h

and use "using namespace std;" after usaing directories

#include<iostream.h> 
#include<conio.h>

correction
#include<iostream> 
#include<conio.h>
using namespace std;

overall code is working with correctly..

All students pay attention to the assignment requirements and also take a look at the solution of assignment 1for proper understanding.

None of u have implemented the concepts of inheritance and aggregation.

Inheritance:

Land and Air transport will inherit from transport class. For this just add :public Transport in the declaration of both these classes and inheritance is done.

eg class Land_Transport : public Transport  // same for Air transport

Aggregation:

If u look at the UML diagram company is an aggregation of Hall and room

aggregation is implemented in terms of including pointers to contained classes in base class.

in class company include pointer of room object and hall objects. I hope u get it.

eg class Company

{

Hall* Halls[10];

Room* Rooms[20];

.......

.......

}

1st assi.... solution

Attachments:

.....

i made my assignment if any body have question or help can ask here..

umer zaman bro reply plz....

here is inheritance 

class Transport
{
private:

int weight,speed,capcity;

public:

Transport()
{

}

void Carray_Goods()
{

}


};
class Land_Transport:public Transport
{

private:

char *Transportation_Mode,*Vehcile_Type;

public:

Land_Transport()
{

}





};

class Air_Transport:public Transport
{
private:

char Aircraft_Type,Aircraft_type;

public:

Air_Transport()
{

}

};

umer zaman  cell no & email sharing is not allowed at the site..thanks for understanding 

ok Tariq 

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service