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.

# CS201 Assignment#04 Solution & Discussion Due Date:24-01-2011

Only CPP file will be accepted, file other than CPP will be awarded zero (0) marks.

Views: 564

Attachments:

### Replies to This Discussion

any one ?

CHANGE LAYOUT A LITTLE CODE IF YOU CAN AND COMMENT AS YOU LIKE ALSO CHANGE VARIABLE'S NAMES SO IT WILL LOOK DIFFERENT FROM MINE.

#include <iostream.h>
#include <conio.h>
class Price{
private:
int RS;
private:
int PS;
public:
Price();
Price(int,int);
void Print();
Price operator + (Price);};
void Price::Print(){
cout"Price Is " RS " Rupees And " PS " Paisas" endl;}
Price::Price(){RS = 0;PS = 0;}
Price::Price(int Rupee , int Paisa){RS = Rupee;PS  = Paisa;}
Price Price::operator + (Price PRICE_ONE){
Price PRICE_TWO;
const int unit = 100;
if (PRICE_ONE.PS + PS >= unit && (PRICE_ONE.PS + PS) % unit == 0){
PRICE_TWO.RS = (PRICE_ONE.RS  + RS) + (PRICE_ONE.PS + PS) / unit;}
else if (PRICE_ONE.PS + PS >= unit && (PRICE_ONE.PS + PS) % unit != 0){
PRICE_TWO.RS = (PRICE_ONE.RS  + RS) + (PRICE_ONE.PS + PS) / unit;PRICE_TWO.PS  = (PRICE_ONE.PS + PS) % unit;}
else if (PRICE_ONE.PS + PS < unit){
PRICE_TWO.RS = (PRICE_ONE.RS  + RS);PRICE_TWO.PS = (PRICE_ONE.PS + PS);}
return PRICE_TWO;}
int main(){
clrscr();
Price obj1(16,57);
Price obj2(28,72);
obj1.Print();
obj2.Print();
coutendl;
getch();
return 0;}

can any one share 4th solu?

1

2

3

4

5

## VIP Member Badge & Others

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

## Latest Activity

### Jannah ? Hold you deen tight.

5 minutes ago
1 hour ago
2 hours ago
Muhammad Bilal replied to BBA(6th smes)'s discussion assignment 1 spring 2021 in the group MGT402 Cost & Management Accounting
3 hours ago
★---★ ⱮԱϚҠȺហ ȺచȺហ ★---★ updated their profile
3 hours ago
Mani Siddiqui posted a discussion

5 hours ago
5 hours ago
5 hours ago