Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Currency Exchange Successful incorporation of two additional currencies, completed code using switch operation. (4 points) for successful incorporation of additional currencies be sure to include

Currency Exchange

Successful incorporation of two additional currencies, completed code using switch operation.

(4 points) for successful incorporation of additional currencies be sure to include snips of your results

(2 points) for consistent/appropriate style and commenting

// This program performs currency conversion from dollars to // E => euros // P => pesos // S => pounds sterling #include #include using namespace std; int main() { double dollars, equivalentCurr; // variables for dollar amount and equivalent value char currencyCode; // variable for selecting currency const double ECONVERSION{0.7041}, // conversion rate for euros PCONVERSION{11.6325}, // conversion rate for pesos SCONVERSION{0.6144}; // conversion rate for pounds cout << "enter dollar amount" << endl; // Prompt user for dollar value cin >> dollars; // Save the user input to dollars cout << "enter currency code: " // Prompt user for currency input << "E => Euros " "P => Mexican Pesos " "S => British Pounds Sterling " ; cin >> currencyCode; // Save the user input for which currency switch(toupper(currencyCode)) { case 'E': // Calculation to make if euros selected cout << "converting dollars to euros.. "; equivalentCurr = dollars * ECONVERSION; break; case 'P': // Calculation to make if pesos selected cout << "converting dollars to pesos.. "; equivalentCurr = dollars * PCONVERSION; break; case 'S': // Calculation to make if pounds selected cout << "converting dollars to pounds sterling.. "; equivalentCurr = dollars * SCONVERSION; break; default: // Calculation to make if invalid input selected cout << currencyCode << "not supported at this time "; equivalentCurr = dollars; break; } cout << "Equivalent amount: " << equivalentCurr << endl; // Print the result return 0; }

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

3. How frequently do the assessments occur?

Answered: 1 week ago