Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!