1. Design an algorithm that will read two numbers and an integer code from the screen (print a menu of the choices first). If the code is 1, compute the sum of the two numbers. If the code is 2, compute the difference of the first number minus the second. If the code is 3, compute the product. If the code is 4 and the second number is not 0, compute the quotient (divide the first number by the second). If the code is not 1,2,3, or 4, display an error message. Finally, display the two numbers, the code, and the result (echo the input).
2. Create an entire program that allows a user to exchange other currencies for US Dollars.
Your program should first display a menu of possible exchanges:
To Convert Canadian Dollars to US Dollars choose 1
To Convert Euros to US Dollars choose 2
To Convert Indian Rupees to US Dollars choose 3
To Convert Japanese Yen to US Dollars choose 4
To Convert Mexican Pesos to US Dollars choose 5
After the user chooses an exchange currency, the program should ask the user if they are a US Resident, and set a resident flag in the program according to the answer.
Are you a US Resident? [Y/N]:
Finally, your program should prompt for the number of foreign currency units to convert and should calculate and display the appropriate exchange value using the following scales.
Currency Resident exchange rate Non-resident exchange rate
Canadian Dollars .9813 1.00
Euros .757 .8
Indian Rupees 52.53 55
Japanese Yen 80.92 85
Mexican Pesos 13.15 15
For user input:
Enter choice: 4
Are you a US Resident? [Y/N]: N
Enter foreign currency units: 80000
Should generate output:
80000 Yen can be exchanged for 941.17 US Dollars.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
using namespace std;
int choice, num1, num2,
cout << "Enter number 1: ";
cin >> num1;
cout << "Enter number 2: ";
cin >> num2;
cout << "Choices: \n1. Add the numbers\n2. Computer the difference of the numbers\n3. Compute the product\n4. Compute the quotient (assuming number 2 isn't 0\nEnter code: ";
cin >> choice;
if(choice == 1)
result = num1+num2;
else if(choice == 2)
result = num1-num2;
else if(choice == 3)...
This is only a preview of the solution. Please use the purchase button to see the entire solution