Answer to Question #185659 in C++ for Jadeeshwaran

Question #185659

The union bank needs to convert rupees to dollar and vice versa perform this conversion using conversion routines (here rupees and dollar are two classes).



1
Expert's answer
2021-04-26T14:21:07-0400
#include<bits/stdc++.h>
using namespace std;


class Dollar{
	private:
		int dollar;
	public:
		Dollar(int d = 0):dollar(d){}
		void display(){
			cout<<"Dollar value:"<<dollar<<endl;
		}
	
		int getValue(){
			return dollar;
		}


};


class Rupee {
	private:
		int rupee;
	public:
		Rupee(int r = 0):rupee(r){}
		
		Rupee(Dollar d){
			rupee = 74.95 * d.getValue();
		}
		void display(){
			cout<<"Rupee value:"<<rupee<<endl;
		}
};


int main(){
	Dollar d1(100);
	Rupee r1;
	r1 = d1;
	d1.display();
	r1.display();
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS