We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Assignment No. 02 SEMESTER Fall 2016 CS304- Object Oriented Programming Total Marks: 20 Due Date: 01 /12/2016

Assignment No. 02
SEMESTER Fall 2016
CS304- Object Oriented Programming Total Marks: 20
Due Date: 01 /12/2016

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, Composition etc.

For any query about the assignment, contact at cs304@vu.edu.pk
GOOD LUCK!
Marks: 20

Problem Statement:
In continuation of Assignment No. 1, we have the following part of class diagram showing composition relationship:

You are required to implement above class diagram (complete program) in C++ with all data members, constructors, member functions and concept (composition) given in the class diagram/table 1.
See the sample output to view the messages you need to print in constructors of all classes. In case of parameterize constructors, you can select any of data member(s) according to the type of constructor.

Class Name Attribute Name Attribute Data Type Functions
Galaxy
Size Integer -Default constructor
-Getters and Setters
Mass Double
Age Integer
Star

Size Integer -Default constructor
-One parameter overloaded constructor()
-Getters and Setters
Mass Double
Age Integer
Planet

Size Integer -Default constructor
-Two parameters overloaded Constructor
-Getters and Setters
Mass Double
Velocity Double
Satellite

Size Integer -Default constructor()
-Three parameter overloaded Constructor
-Getters and Setters
Mass Double
Velocity Double
Table 1: Classes


Sample Output:

Best of luck!

Lectures Covered: This assignment covers Lecture # 7-15
Deadline: Your assignment must be uploaded/submitted at or before December 1, 2016

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 7087

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>

 

Note:-

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

Or visit this link 

Click Here For Detail.

&

.•°How to Download past papers from study groups°•. 

Dear Students hers is complete solution of Assignment No. 2 

Dear Students Don’t wait for solution post your problems here and discuss ... after discussion a perfect solution will come in a result. So, Start it now, replies here give your comments according to your knowledge and understandings....

//Assignment # 2 Solution
#include<iostream>
using namespace std;


class Star
{
private:
int size;
double mass;
int age;
public :
Star()
{
cout"star constructor (default) called !\n";
size=0;
mass=0.0;
age=0;
}
Star(int s)
{
cout"\nStar constructor (one parameter) called ! \n";
size=s;
mass=0.0;
age=0;
}
// setter
void set_size(int s)
{
size=s;
}
void set_mass(double m)
{
mass=m;
}
void set_age(int a)
{
age=a;
}
// getter
int get_size()
{
return size;
}
double get_mass()
{
return mass;
}
int get_age()
{
return age;
}
};
class Planet
{
private:
int size;
double mass;
double velocity;
public :
Planet()
{
cout"\nPlanet constructor (default) called !\n";
size=0;
mass=0.0;
velocity=0.0;
}
Planet(int s,double m)
{
cout"\nPlanet constructor (two parameter) called !\n";
size=s;
mass=m;
velocity=0.0;
}
// setter
void set_size(int s)
{
size=s;
}
void set_mass(double m)
{
mass=m;
}
void set_velocity(int v)
{
velocity=v;
}
// getter
int get_size()
{
return size;
}
double get_mass()
{
return mass;
}
int get_velocity()
{
return velocity;
}

};
class Satellite
{
private:
int size;
double mass;
double velocity;
public :
Satellite()
{
cout"\nSatellite constructor (default) called ! \n";
size=0;
mass=0.0;
velocity=0.0;
}
Satellite(int s,double m,double v)
{
cout"\nSatellite constructor (three parameter) called ! \n";
size=v;
mass=m;
velocity=v;
}
// setter
void set_size(int s)
{
size=s;
}
void set_mass(double m)
{
mass=m;
}
void set_velocity(int v)
{
velocity=v;
}
// getter
int get_size()
{
return size;
}
double get_mass()
{
return mass;
}
int get_velocity()
{
return velocity;
}
};

class Galaxy
{
private :
int size;
double mass;
int age;
Star *s= new Star(54);
Planet *p= new Planet(54, 780.99);
Satellite *st= new Satellite(54, 780.4, 44.7);
public :
Galaxy()
{
cout"\nGalaxy constructor (default) called ! \n";
size=0;
mass=0;
age=0;
}
void set_size(int s)
{
size=s;
}
void set_mass(double m)
{
mass=m;
}
void set_age(int a)
{
age=a;
}
int get_size()
{
return size;
}
double get_mass()
{
return mass;
}
int get_age()
{
return age;
}
};
main()
{
Galaxy g;
}

Refined and error free code.

A little modification will good for you people.

Attachments:

i need solution in cpp format please help me 

sir, it giving error on this line. what could be the reason? error "new cannot appear in constant-expression"

Star *s= new Star(54);

see the attached file CS304 Assignment#02 Solution 

Attachments:

is main error hai

yh kia hai???

Solution hai or thk hai proper compile kar k dekho

RSS

Latest Activity

Rabia kiran left a comment for Mahmood Rana
1 minute ago
abdul ghafoor replied to + M.Tariq Malik's discussion PSY101 Current Mid Term Papers Fall 2019 (14 to 26 December 2019) & All Solved Past Papers, Solved MCQs & Helping Material in the group PSY101 Introduction to Psychology
7 minutes ago
zoobi noor commented on Zainab Mughal's blog post LAMBA DHAGA AUR LMBI ZUBAN
10 minutes ago
zoobi noor liked Zainab Mughal's blog post LAMBA DHAGA AUR LMBI ZUBAN
11 minutes ago
zoobi noor liked +!!!StRaNGeR!!! +'s discussion ﺗﺮﺍ ﻧﺎﻡ ﺗﮏ ﺑﮭﻼ ﺩﻭﮞ، ﺗﺮﯼ ﯾﺎﺩ ﺗﮏ ﻣﭩﺎ ﺩﻭﮞ
11 minutes ago
zoobi noor liked +¢αяєℓєѕѕ gιяℓ's discussion ٹی وی پر ڈرامہ چل رہا تھا
13 minutes ago
Desert11 Hakru commented on + M.Tariq Malik's group MGMT615 Transportation & Logistics Management
13 minutes ago
Imran bs(i.t) updated their profile
17 minutes ago
Desert11 Hakru joined + M.Tariq Malik's group
21 minutes ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + " J ɨ y α •" ⋆'s discussion Let's celebrate the Birthday of our Beloved Mod + "αяsαℓ " Ќąƶµяɨ •"
24 minutes ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + " J ɨ y α •" ⋆'s discussion Let's celebrate the Birthday of our Beloved Mod + "αяsαℓ " Ќąƶµяɨ •"
24 minutes ago
+ "αяsαℓ " Ќąƶµяɨ •" replied to + " J ɨ y α •" ⋆'s discussion Let's celebrate the Birthday of our Beloved Mod + "αяsαℓ " Ќąƶµяɨ •"
24 minutes ago

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

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

.