|* create a program named currency converter.cpp use the following pseudocode to write the program: this program will take US dollars and convert to either Canadian dollars, or Mexican pesos. welcome the user to Currency Converter! ask them to input the number of dollars they wish to convert validate their amount (no amounts less than or equal to zero) & display a message saying invalid entry, dollars must be greater than zero. ask them which country they wish to convert their money use these exchange rates: 1 US Dollar is equal to 1.31 Canadian dollars; 1 US Dollars is equal to 20.39 pesos. validate their country choice-if 1 and 2 are used for countries, and they input another number, display an invalid entry message and loop until they enter a valid entry. you will declare two functions to convert dollars: call one convertCanada and the other convertMexico. if the user selects Canada, call the convertCanada function; if they select Mexico, call the convertMexico function. when you call either of these functions, pass the dollars amount's value to the function. place the functions' definitions below the main function. convertCanada and convertMexico will multiply the dollars value times the (from above) and display it in a sentence. fomat the currency to two decimal places, showing the decimal points alwa For example: If user inputs ten for dollars and chooses Canada, it should o "That is equal to 13.10 Canadian dollars." declare function prototypes for convertCanada and convertMexico above th test your program for every possibility: 1) the user enters invalid entry for dollars 2) the user enters invalid entry for country 3) user chooses Canada 4) the user chooses Mexico if all works, submit your file"/

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

answer this in c++

This is a pseudocode outline for creating a currency converter program in C++. The program will convert US dollars into either Canadian dollars or Mexican pesos.

### Key Steps and Details:

1. **User Input:**
   - Prompt the user to input the number of US dollars they wish to convert.
   - Validate this input to ensure the amount is greater than zero. If invalid, display an error message: "Invalid entry, dollars must be greater than zero."

2. **Currency Selection:**
   - Ask the user to choose which currency to convert to: Canadian dollars or Mexican pesos.
   - Utilize the following exchange rates:
     - 1 US Dollar = 1.31 Canadian Dollars
     - 1 US Dollar = 20.39 Mexican Pesos
   - Validate the user's currency choice. If the choice is not 1 (Canada) or 2 (Mexico), display an error message and prompt again until a valid choice is entered.

3. **Conversion Functions:**
   - Implement two conversion functions:
     - `convertCanada`: Converts dollars to Canadian dollars.
     - `convertMexico`: Converts dollars to Mexican pesos.
   - These functions multiply the dollar amount by the respective exchange rate and return the converted value formatted to two decimal places (e.g., "13.10 Canadian dollars").

4. **Function Structure:**
   - Define the `convertCanada` and `convertMexico` functions below the main program function.
   - Pass the dollar amount as an argument to these functions.

5. **Input Validation:**
   - Ensure thorough testing by checking:
     1. Invalid dollar input.
     2. Invalid country choice.
     3. Correct conversion when choosing Canada.
     4. Correct conversion when choosing Mexico.

6. **Finalization:**
   - Successfully working program allows submission of the program file.

This structured approach ensures the program handles all possible user inputs accurately and performs the currency conversion correctly based on the user's choice.
Transcribed Image Text:This is a pseudocode outline for creating a currency converter program in C++. The program will convert US dollars into either Canadian dollars or Mexican pesos. ### Key Steps and Details: 1. **User Input:** - Prompt the user to input the number of US dollars they wish to convert. - Validate this input to ensure the amount is greater than zero. If invalid, display an error message: "Invalid entry, dollars must be greater than zero." 2. **Currency Selection:** - Ask the user to choose which currency to convert to: Canadian dollars or Mexican pesos. - Utilize the following exchange rates: - 1 US Dollar = 1.31 Canadian Dollars - 1 US Dollar = 20.39 Mexican Pesos - Validate the user's currency choice. If the choice is not 1 (Canada) or 2 (Mexico), display an error message and prompt again until a valid choice is entered. 3. **Conversion Functions:** - Implement two conversion functions: - `convertCanada`: Converts dollars to Canadian dollars. - `convertMexico`: Converts dollars to Mexican pesos. - These functions multiply the dollar amount by the respective exchange rate and return the converted value formatted to two decimal places (e.g., "13.10 Canadian dollars"). 4. **Function Structure:** - Define the `convertCanada` and `convertMexico` functions below the main program function. - Pass the dollar amount as an argument to these functions. 5. **Input Validation:** - Ensure thorough testing by checking: 1. Invalid dollar input. 2. Invalid country choice. 3. Correct conversion when choosing Canada. 4. Correct conversion when choosing Mexico. 6. **Finalization:** - Successfully working program allows submission of the program file. This structured approach ensures the program handles all possible user inputs accurately and performs the currency conversion correctly based on the user's choice.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Algebraic Expressions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education