QuestionQuestion

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

Enter choice:

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.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include <iostream>

using namespace std;

int main()
{
int choice, num1, num2,
result;
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)...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$20.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats