Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Currency Conversion: Create a C++ program that can calculate the currency co

ID: 3776351 • Letter: C

Question

C++

Currency Conversion: Create a C++ program that can calculate the currency conversion rates for foreign currencies into dollars. (The more currencies that can be converted the better.) Prompt the user to enter the currency she wants to convert and the amount of money she needs converted. This project must be accompanied by a creative GUI design. Introducing API’s, online integration, and a GUI will make the project unique.

Please write a paragraph explaning how your program works above the source code.

Explanation / Answer

program   

#include <iostream>
#ifdef WIN32
#include <windows.h>
#endif
#include "console.h"
#include "clearscreen.h"
namespace con = JadedHoboConsole;
int main()
{
using std::cout;
using std::endl;
using std::cin;
char choice;
do
{
int curr;
float eurosdollars, dollarseuros, dollarsyen, yendollars, dollarsUKpounds, UKpoundsdollars, dollarkronor, kronordollar, dollarrubles, rublesdollar;
cout << con::fg_white <<" ************************ "
<< con::fg_blue <<"1. Dollars to Euros 2. Euros to Dollars "
<< con::fg_green <<" 3. Dollars to Yen 4. Yen to Dollars "
   << con::fg_red <<" 5. Dollars to UK Pounds 6. UK Pounds to Dollars "
   << con::fg_white <<" 7. Dollars to Sweden Kronor 8. Sweden Kronor to Dollars "
   << con::fg_magenta <<" 9. Dollars to Russian Rubles 10. Russian Rubles to Dollars "
<< con::fg_white <<" ************************ "<< endl;
cout << con::fg_yellow <<" Please enter the number of the currency you want to convert: ";
cin >> currency;
switch (currency)
{
case 1:
cout << con::fg_blue <<" Please enter the amount of United States Dollars you would like to convert to European Euros: ";
cin >> eurosdollars;
cout << con::fg_blue <<" You have entered " << eurosdollars << " Dollars which is equal to " << eurosdollars*0.678518116 << " Euros." << endl;
break;
case 2:
cout << con::fg_blue <<" Please enter the amount of European Euros you would like convert to United States Dollars: ";
cin >> dollarseuros;
cout << con::fg_blue <<" You have entered " << dollarseuros << " Euros which is equal to " << dollarseuros*1.4738 << " Dollars." << endl;
break;
case 3:
cout << con::fg_green <<" Please enter the amount of United States Dollars you would like to convert to Japanese Yen: ";
cin >> dollarsyen;
cout << con::fg_green <<" You have entered " << dollarsyen << " Dollars which is equal to " << dollarsyen*95.71255 << " Yen." << endl;
break;
case 4:
cout << con::fg_green <<" Please enter the amount of Japanese Yen you would like to convert to United States Dollars: ";
cin >> yendollars;
cout << con::fg_green <<" You have entered " << yendollars << " Yen which is equal to " << yendollars*0.0105652 << " Dollars." << endl;
break;
case 5:
cout << con::fg_red<<" Please enter the amount of United States Dollars you would like to convert to United Kingdom Pounds: ";
cin >> dollarsUKpounds;
cout << con::fg_red<<" You have entered " << dollarsUKpounds << " Dollars which is equal to " << dollarsUKpounds*0.598787 << " United Kingdom Pounds." << endl;
break;
case 6:
cout << con::fg_red<<" Please enter the United Kingdom Pounds you would like to covert to United States Dollars: ";
cin >> UKpoundsdollars;
cout << con::fg_red<<" You have entered " << UKpoundsdollars << " United Kingdom Pounds which is equal to " << UKpoundsdollars*1.67004 << " Dollars." << endl;
break;
case 7:
cout << con::fg_white<<" Please enter the amount of United States Dollars you would like to convert to Sweden Kronor: ";
cin >> dollarkronor;
cout << con::fg_white<<" You have entered " << dollarkronor << " Dollars which is equal to " << dollarkronor*7.19434 << " Sweden Kronor." << endl;
break;
case 8:
cout << con::fg_white <<" Please enter the amount of Sweden Kronor you would like to convert to United States Dollars: ";
cin >> kronordollar;
cout << con::fg_white <<" You have entered " << kronordollar << " Kronor which is equal to " << kronordollar*0.138998 << " United States Dollars." << endl;
break;
case 9:
cout << con::fg_magenta <<" Please enter the amount of United States Dollars you would like to convert to Russian Rubles: ";
cin >> dollarrubles;
cout << con::fg_magenta <<" You have entered " << dollarrubles << " Dollars which is equal to " << dollarrubles*31.5650 << " Russian Rubles." << endl;
break;
case 10:
cout << con::fg_magenta <<" Please enter the amount of Russian Rubles you would like to convert to United States Dollars: ";
cin >> rublesdollar;
cout << con::fg_magenta <<" You have entered " << rublesdollar << " Rubles which is equal to " << rublesdollar*0.0316807 << " United States Dollar." << endl;
break;
}
if (curr> 10)
{
ClearScreen();
cout << con::fg_white <<" Please only choose a number from the list.";
int seconds = 1;
#ifdef WIN32
Sleep(seconds*3000);
#else
sleep(seconds);
#endif
return main ();
}
else if (curr < 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
cout << " Do you want to convert again? (Y/N) ";
cin >> choice;
}
while(choice != 'n' && choice != 'N');
cout << con::clr <<" Goodbye! ";
int seconds = 1;
#ifdef WIN32
Sleep(seconds*2000);
#else
sleep(seconds);
#endif
return 0;
}