Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need someone to separate header file, class file and main file of my following program. Please explain your changes and run the program through

I need someone to separate header file, class file and main file of my following program. Please explain your changes and run the program through ur computer terminal to make sure it is working, and attach the screenshot of output.

#include using namespace std;

#define YEN_VALUE 109.20 #define EURO_VALUE 0.87 #define PESO_VALUE 19.02

class CurrencyConvert { private: float dollar, yen, euro, peso; public: CurrencyConvert (float dollarInput) { dollar = dollarInput; } //Method 1 void toYen() { yen = dollar * YEN_VALUE; cout << dollar << " dollar equals " << yen <<" yen "<< endl; } //Method 2 void toEuro() { euro = dollar * EURO_VALUE; cout << dollar << " dollar equals " << euro << " euro "<< endl; } //Method 3 void toPeso() { peso = dollar * PESO_VALUE; cout << dollar << " dollar equals " << peso << " peso "<< endl; } //Method 4 void toAll() { yen = dollar * YEN_VALUE; cout << dollar << " dollar equals "<< yen << " yen "<< endl; euro = dollar * EURO_VALUE; cout << dollar << " dollar equals "<< euro << " euro "<< endl; peso = dollar * PESO_VALUE; cout << dollar << " dollar equals "<< peso << " peso "<< endl; } };

int main() { float dollar; int choice;

cout << endl << "Enter dollar value : "; cin >> dollar;

while(1) { if (dollar > 0) { CurrencyConvert obj(dollar); cout << endl << "Currency Conversion "<< endl; cout << "1.To Yen "<< endl; cout << "2.To Euro "<< endl; cout << "3.To Peso "<< endl; cout<<"4.To All "<< endl; cout << "Enter your choice : "<< endl; cin >> choice;

switch(choice) { case 1: obj.toYen(); break; case 2: obj.toEuro(); break; case 3: obj.toPeso(); break; case 4: obj.toAll(); break; default: cout << "Enter correct choice "; break; } } else { cout << endl << "Exiting....."; exit(0); } cout << "Enter dollar value : "; cin >> dollar; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Apache Cassandra 3 X An Expert Guide To Improving Database Scalability And Availability Without Compromising Performance

Authors: Aaron Ploetz ,Tejaswi Malepati ,Nishant Neeraj

3rd Edition

1789131499, 978-1789131499

More Books

Students also viewed these Databases questions