Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with a program that uses loops, program starts off with a currency converter which is; #include #include using namespace std; const int USD =

Help with a program that uses loops, program starts off with a currency converter which is;

#include

#include

using namespace std;

const int USD = 0;

const int EUR = 1;

const int GBP = 2;

const int INR = 3;

const int AUD = 4;

const int CAD = 5;

const int ZAR = 6;

const int NZD = 7;

const int JPY = 8;

//Outputs a menu of currency types for user, returning a constant value

// as defined above representing the selected currency.

int getUserSelection ()

{

int selection;

cout

cout

cout

cout

cout

cout

cout

cout

cout

cout

cin >> selection;

return selection;

}

//Converts the numeric type to a String representation.

//Use this to output a String representation of the type.

string convertTypeToString(int type)

{

switch (type)

{

case USD:

return "US Dollars";

case EUR:

return "Euros";

case GBP:

return "Great Britan Pounds";

case INR:

return "Indian Rupees";

case AUD:

return "Australian Dollars";

case CAD:

return "Canadian Dollars";

case ZAR:

return "South African Rands";

case NZD:

return "New Zealand Dollars";

case JPY:

return "Japanese Zen";

}

return "";

}

int main(int argc, char *argv[])

{

int userSelection = getUserSelection();

string selectionAsAString = convertTypeToString(userSelection);

cout

cin.ignore();

cin.get();

}

The rest of the instructions is attached! Thank youimage text in transcribedimage text in transcribedimage text in transcribed

Complete a program that allows a user to select a currency to be converted to US dollars Your program should loop, use the code given to display a menu of conversion types and get a user selection, then input an amount of the selected currency, convert it to US dollars, and output the result. Use this conversion chart to get the conversion factors for each type of currency: Auto-refresh 15x 0: 38 USD EUR GBP INR AUD CAD ZAR NZD JPY 1 USD 1.00000 0.92072 0.69215 66.8904 1.43135 1.42628 16.6697 1.52973117.675 Inverse: 1.00000 1.08611 1.44476 0.01495 0.69864 0.70112 0.05999 0.65371 0.00850 1 EUR 108611 1.00000 0.75176 72.6504 1.55460 1.54910 18.1051 1.66145127.808 Inverse: 0.92072 1.00000 1.33022 0.01376 0.64325 0.64554 0.05523 0.60188 0.00782 1 GBP 1.44476 1.33022 1.00000 96.6409 2.06796 2.06064 24.0837 2 21009 170.013 Inverse: 0.69215 0.75176 1.00000 0.01035 0.48357 0.48529 0.04152 0.45247 0.00588 Mid-market rates: 2018-01-12 22 03 UTO You have been given code that includes two functions for you to use (we'll learn more about functions in the next module) Here is the main function that shows using the code you have been provided int main(int argc, char *argv[]) int userSelection = getUserSelection(); string selectionAsAString convertTypeToString(userSelection) cout

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_2

Step: 3

blur-text-image_3

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

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions

Question

A 300N F 30% d 2 m Answered: 1 week ago

Answered: 1 week ago

Question

Do you think physicians should have unions? Why or why not?

Answered: 1 week ago