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 proper comments. Sample interaction will look something like this (user input appears boldface and underlined):

 Create a Perl program that will convert money from U.S. dollars
//*********************************** text to copy
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 (yeso)? 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 (yeso)? 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 (yeso)? no
Thank you for your business
//***********************************

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 (yeso)? 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 (yeso)? 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 (yeso)? no Thank you for your business

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!