#ifndef CURRENCY_HELPER_HPP #define CURRENCY_HELPER_HPP #include "Helper.hpp" #include double CurrencyConversion(double& Money); void CurrencyList(); double Dollars_USD(double& Money); double Euro_EUR(double& Money); double Yen_JPY(double& Money); double Pound_GBP(double& Money); double Rand_ZAR(double& Money); double CurrencyConversion(double& Money) { system("cls"); int Selection = 0; CurrencyList(); Selection = InputSelectionInt("What type of currency are you looking to convert from? :"); Money = InputDouble("How much do you have?"); switch (Selection) { case 1: Dollars_USD(Money); break; case 2: Euro_EUR(Money); break; case 3: Yen_JPY(Money); break; case 4: Pound_GBP(Money); break; case 5: Rand_ZAR(Money); break; default: std::cout << "Invalid input, please try again!" << std::endl; } return Money; } double Dollars_USD(double& Money) { int UserSelect1; Prompts("1.Dollar to Euro\n2.Dollar to Yen\n3.Dollar to Pound\n4.Dollar to Rand\n"); UserSelect1 = InputSelectionInt("What would you like to convert your U.S Dollars to? :"); switch (UserSelect1) { case 1: Money *= 0.93995; //Dollars to Euro std::cout << "(EUR)" << Money << std::endl; break; case 2: Money *= 153.225; //Dollars to Yen std::cout << "(JPY)" << Money << std::endl; break; case 3: Money *= 0.80337; //Dollars to Pound std::cout << "(GBP)" << Money << std::endl; break; case 4: Money *= 18.898; //Dollars to Rand std::cout << "(ZAR)" << Money << std::endl; break; default: std::cout << "Invalid input, please try again!" << std::endl; } return Money; } double Euro_EUR(double& Money) { int UserSelect2 = 0; Prompts("1.Euro to Dollar\n2.Euro to Yen\n3.Euro to Pound\n4.Euro to Rand\n"); UserSelect2 = InputSelectionInt("What would you like to convert your European Euros to? :"); switch (UserSelect2) { case 1: Money *= 1.064; //Euros to Dollars std::cout << "$" << Money << std::endl; break; case 2: Money *= 163.025; //Euros to Yen std::cout << "(JPY)" << Money << std::endl; break; case 3: Money *= 0.8547; //Euros to Pound std::cout << "(GBP)" << Money << std::endl; break; case 4: Money *= 20.102; //Euros to Rand std::cout << "(ZAR)" << Money << std::endl; break; default: std::cout << "Invalid input, please try again!" << std::endl; } return Money; } double Yen_JPY(double& Money) { int UserSelect3 = 0; Prompts("1.Yen to Dollar\n2.Yen to Euro\n3.Yen to Pound\n4.Yen to Rand\n"); UserSelect3 = InputSelectionInt("What would you like to convert your Japanese Yens to? :"); switch (UserSelect3) { case 1: Money *= 0.0065; //Yen to Dollars std::cout << "$" << Money << std::endl; break; case 2: Money *= 0.0061; //Yen to Euros std::cout << "(EUR)" << Money << std::endl; break; case 3: Money *= 0.0052; //Yen to Pound std::cout << "(GBP)" << Money << std::endl; break; case 4: Money *= 0.123; //Yen to Rand std::cout << "(ZAR)" << Money << std::endl; break; default: std::cout << "Invalid input, please try again!" << std::endl; } return Money; } double Pound_GBP(double& Money) { int UserSelect3 = 0; Prompts("1.Pound to Dollar\n2.Pound to Euro\n3.Pound to Yen\n4.Pound to Rand\n"); UserSelect3 = InputSelectionInt("What would you like to convert your British Pounds to? :"); switch (UserSelect3) { case 1: Money *= 1.244; //Pound to Dollars std::cout << "$" << Money << std::endl; break; case 2: Money *= 1.169; //Pound to Euros std::cout << "(EUR)" << Money << std::endl; break; case 3: Money *= 190.755; //Pound to Yen std::cout << "(JPY)" << Money << std::endl; break; case 4: Money *= 23.513; //Pound to Rand std::cout << "(ZAR)" << Money << std::endl; break; default: std::cout << "Invalid input, please try again!" << std::endl; } return Money; } double Rand_ZAR(double& Money) { int UserSelect4 = 0; Prompts("1.Rand to Dollar\n2.Rand to Euro\n3.Rand to Yen\n4.Yen to Pound\n"); UserSelect4 = InputSelectionInt("What would you like to convert your South African Rands to?: "); switch (UserSelect4) { case 1: Money *= 0.0529; //Rand to Dollars std::cout << "$" << Money << std::endl; break; case 2: Money *= 0.497; //Rand to Euros std::cout << "(EUR)" << Money << std::endl; break; case 3: Money *= 8.111; //Rand to Yen std::cout << "(JPY)" << Money << std::endl; break; case 4: Money *= 0.0425; //Rand to Pound std::cout << "(GBP)" << Money << std::endl; break; default: std::cout << "Invalid input, please try again!" << std::endl; } return Money; } void CurrencyList() { std::cout << "Welcome to the Currency Exchange\n\n" << "1. U.S Dollars(USD)\n" << "2. European Euros(EUR)\n" << "3. Japanese Yens(JPY)\n" << "4. British Pounds\n" << "5. South African Rand(ZAR)\n" << std::endl; } #endif