Question: Exercise 1 : Run this program and observe the results. You can input anything that you like for the dollars to be converted. Notice that

Exercise 1: Run this program and observe the results. You can input anything
that you like for the dollars to be converted. Notice that it has stubs as
well as overloaded functions. Study the stubs carefully. Notice that in this
case the value returning functions always return 0.
Exercise 2: Complete the program by turning all the stubs into workable
functions. Be sure to call true functions differently than procedures. Make
sure that functions return the converted dollars into the proper currency.
Although the exchange rates 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.
One Dollar =1.06 euros
9.73 pesos
124.35 yen
usi#include
#include
using namespace std;
// This program will input American money and convert it to foreign currency
// your name
// Constants for conversion rates
const double EURO_RATE =1.06;
const double PESO_RATE =9.73;
const double YEN_RATE =124.35;
// Prototypes of the functions
void convertMulti(float dollars, float& euros, float& pesos);
void convertMulti(float dollars, float& euros, float& pesos, float& yen);
float convertToYen(float dollars);
float convertToEuros(float dollars);
float convertToPesos(float dollars);
int main()
{
float dollars;
float euros;
float pesos;
float yen;
cout << fixed << showpoint << setprecision(2);
cout << "Please input the amount of American Dollars you want converted "
<< endl;
cout <<"to euros and pesos" << endl;
cin >> dollars;
// Fill in the code to call convertMulti with parameters dollars, euros, and pesos
void convertMulti(float dollars, float& euros, float& pesos);
// Fill in the code to output the value of those dollars converted to both euros
// and pesos
cout <<"$"<< dollars <<" is converted to "<< euros <<" euros, "<< pesos <<" pesos" << endl;
cout << "Please input the amount of American Dollars you want converted
";
cout <<"to euros, pesos and yen" << endl;
cin >> dollars;
// Fill in the code to call convertMulti with parameters dollars, euros, pesos and yen
void convertMulti(float dollars, float& euros, float& pesos, float& yen);
// Fill in the code to output the value of those dollars converted to euros,
// pesos and yen
cout <<"$"<< dollars <<" is converted to "<< euros <<" euros, "<< pesos <<" pesos, and "<< yen <<" yen" << endl;
cout << "Please input the amount of American Dollars you want converted
";
cout <<"to yen" << endl;
cin >> dollars;
// Fill in the code to call convertToYen
void convertToYen(float dollars);
// Fill in the code to output the value of those dollars converted to yen
cout <<"$"<< dollars <<" is converted to "<< yen <<" yen" << endl;
cout << "Please input the amount of American Dollars you want converted
";
cout <<" to euros" << endl;
cin >> dollars;
// Fill in the code to call convert ToEuros
void convertToEuros(float dollars);
// Fill in the code to output the value of those dollars converted to euros
cout <<"$"<< dollars <<" is converted to "<< euros <<" euros" << endl;
cout << "Please input the amount of American Dollars you want converted
";
cout <<" to pesos "<< endl;
cin >> dollars;
// Fill in the code to call convertToPesos
void convertToPesos(float dollars);
// Fill in the code to output the value of those dollars converted to pesos
cout <<"$"<< dollars <<" is converted to "<< pesos <<" pesos" << endl;
return 0;
}
// All of the functions are stubs that just serve to test the functions
// Replace with code that will cause the functions to execute properly
//**************************************************************************
// convertMulti
//
// task: This function takes a dollar value and converts it to euros
// and pesos
// data in: dollars
// data out: euros and pesos
//
//*************************************************************************
void convertMulti(float dollars, float& euros, float& pesos)
{
cout << "The function convertMulti with dollars, euros and pesos "
<< endl <<" was called with "<< dollars <<" dollars" << endl << endl;
}
//************************************************************************
// convertMulti
//
// task: This function takes a dollar value and converts it to euros
// pesos and yen
// data in: dollars
// data out: euros pesos yen
//
//***********************************************************************
void convertMulti(float dollars, float& euros, float& pesos, float& yen)
{
cout << "The function convertMulti with dollars, euros, pesos and yen"
<< endl <<" was called with "<< dollars <<" dollars" << endl << endl;
}
//********************************

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!