www.vustudents.ning.com

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

# CS304 Assignment #2 Solution

Dear students please discuss here about the solution of CS304 ( Object Oriented Programming ) assignment #2.

Views: 10830

Attachments:

### Replies to This Discussion

Good

This video is good.... but this is related to 1st assignment, not for the 2nd once! Kindly help in 2nd assignment.

solution of this assignment . . ..... .

Dear student please do a bit struggle yourself. It's your assignment try to do something yourself.

output kia dana hay open ni ho raha

salam brother ya lec khud build kia ha ???i m listening this u have any data strucutre practicle implementation lec

yaar ye to open hi nahi hor rahi chale gi kese ?

Bhai code ke file share kardo khali output file hai ye to.

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.

Exactly :)

koe mujy smjy ga k is assignment mae karna kaya hai

for practice of inheritance
#include
<iostream>
using namespace std;
// Base class Shape
class Shape {
public:
void setWidth(int w)
{
width
= w;
}
void setHeight(int h)
{
height
= h;
}
protected:
int width;
int height; };
// Base class PaintCost
class PaintCost {
public:
int getCost(int area)
{
return area * 70;
}
};
// Derived class
class Rectangle: public Shape, public PaintCost {
public:
int getArea() {
return (width * height);
}
};
int main(void) { Rectangle Rect;
int area;
Rect.setWidth(5);
Rect.setHeight(7);
area
= Rect.getArea();
// Print the area of the object.
cout
"Total area: " Rect.getArea() endl;
// Print the total cost of painting
cout
"Total paint cost: \$" Rect.getCost(area) endl;
return 0; }

1

2

3

4

5

## VIP Member Badge & Others

------------------------------------

## Latest Activity

Zain Arshad added 2 discussions to the group CS304 Object Oriented Programming
49 seconds ago
usama khan posted a blog post

### Helen Schifter on Wellness

22 minutes ago
Arsal posted a photo

### 20210607_091740

23 minutes ago
+ ! ! ! ! ! !★ "Mannat"★✓ posted a photo

### B612_20210722_221505_607

23 minutes ago
Zohaib Hassan posted a video

### Legend of Punjabi ! This man is Hilarious .

23 minutes ago
47 minutes ago
Muhammad Qasim added a discussion to the group CS502 Fundamentals of Algorithms

48 minutes ago