The following program takes in amount in US dollars and converts it into foreign
ID: 3657635 • Letter: T
Question
The following program takes in amount in US dollars and converts it into foreign currency. Run this program and observe the results. You can input anything for the dollars to be converted. Notice that it has dummy functions (stubs) that always return 0. Complete the program by turning all the stubs into workable functions. Make sure that functions return the converted dollars into the proper currency. Although the exchange rate may vary from day to day, use the following conversion chart for the program. These values should be defined as constants in the global section so that any change in the exchange rate can be made there and nowhere else in the program. Make sure to carefully check that your output is correct.
One dollar = 1.06 euros = 9.73 pesos = 124.35 yen
#include <iostream>
#include <iomanip>
using namespace std;
// This program will get an amount in US dollars and convert it to foreign currency
// Prototypes of the functions
float convertToYen(float dollars);
float convertToEuros(float dollars);
float convertToPesos(float dollars);
int main ()
{
float dollars, euros, pesos, yen;
cout << fixed << showpoint << setprecision(2);
cout << "Please input the amount of American Dollars you want converted: ";
cin >> dollars;
// FILL IN THE CODE TO CONVERT TO YEN, EUROS, AND PESOS AND DISPLAY THE RESULTS
return 0;
}
// ****************************************************************************
// convertToYen
//
// task: This function takes a dollar value and converts it to yen
// data in: dollars
// data returned: yen
//
// ***************************************************************************
float convertToYen(float dollars)
{
// REPLACE WITH CODE THAT WILL CAUSE THE FUNCTIONS TO EXECUTE PROPERLY
return 0;
}
// ****************************************************************************
// convertToEuros
//
// task: This function takes a dollar value and converts it to euros
// data in: dollars
// data returned: euros
//
// ***************************************************************************
float convertToEuros(float dollars)
{
// REPLACE WITH CODE THAT WILL CAUSE THE FUNCTIONS TO EXECUTE PROPERLY
return 0;
}
// *****************************************************************************
// convertToPesos
//
// task: This function takes a dollar value and converts it to pesos
// data in: dollars
// data returned: pesos
//
// ****************************************************************************
float convertToPesos(float dollars)
{
// REPLACE WITH CODE THAT WILL CAUSE THE FUNCTIONS TO EXECUTE PROPERLY
return 0;
}
Explanation / Answer
//One dollar = 1.06 euros = 9.73 pesos = 124.35 yen #include #include using namespace std; // This program will get an amount in US dollars and convert it to foreign currency // Prototypes of the functions float convertToYen(float dollars); float convertToEuros(float dollars); float convertToPesos(float dollars); int main () { float dollars, euros, pesos, yen; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.