Question
Create a Perl program that will convert money from U.S. dollars to other foreign currencies. The program should prompt the user for the amount of
Create a Perl program that will convert money from U.S. dollars to other foreign currencies. The program should prompt the user for the amount of U.S. dollars for how much she wants to have converted. It should then ask if the money should be converted to British Pounds, Canadian dollars, Mexican Pesos or Euros. If the user does not select a valid currency, an appropriate message should be displayed. You should look up the current exchange rates so that your program is up-to-date.
After converting to the proper currency, the amount should be displayed using exactly two decimal places. It should then ask the user if she wishes to continue. If the user says "no", the program should display "Thank you for your business". Your program should include some documentation (at least 5 comment lines). Sample interaction will look something like this (user input appears boldface and underlined):
Convert your U.S. Dollars to foreign currency
How many U.S. Dollars do you want to exchange? 100
Enter P (British Pounds), E (Euros), M (Mexican Pesos), or C (Canadian): E
Your converted amount is 120.00 Euros
Do you want to exchange again (yes/no)? yes
Convert your U.S. Dollars to foreign currency
How many U.S. Dollars do you want to exchange? 50
Enter P (British Pounds), E (Euros), M (Mexican Pesos), or C (Canadian): C
Your converted amount is 60.00 Canadian dollars
Do you want to exchange again (yes/no)? yes
Convert your U.S. Dollars to foreign currency
How many U.S. Dollars do you want to exchange? 100
Enter P (British Pounds), E (Euros), M (Mexican Pesos), or C (Canadian): B
You have entered an invalid choice
Do you want to exchange again (yes/no)? no
Thank you for your business
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started