ISGB 7990 Homework: 2 – Currency converter

$35.00

Download Details:

  • Name: Homework2-u7fere.zip
  • Type: zip
  • Size: 293.29 KB

Category:

Description

5/5 - (1 vote)

Part A:
Build a tool to handle a simple negotiation. You would like to purchase an item but you don’t want to
spend too much. Set a maximum amount you are willing to spend, for example $500, then ask the user
for the price demanded. If the price is greater than your maximum amount, print ‘Sorry, that price is too
high for me.’ If the price is lower than or equal to your maximum amount, print ‘Ok, I would like to
purchase it.’
Part B:
Using lists and if statements, build a tool to convert various amounts of money from one currency to
another. The tool will:
a. Ask the user to enter the amount of money;
b. Ask the user the current currency;
c. Ask to which currency this amount should be converted;
d. Calculate the conversion using exchange rates at the time of programming;
e. Print the results to the user.
Please include the following currencies: Yen (¥), Dollar ($), Euro (€), and Pound (£).
To account for the various ways a user might enter a currency’s name, you will want to create a list for
each currency. For example, ‘$’, ‘dollar’, ‘Dollar’, ‘DOLLAR’ are all ways a user might respond. If you can’t
type the symbol for a currency using your keyboard, you can copy and paste that symbol from the
internet or this PDF. You can also find current exchange rates by googling ‘x to y’ where x is the starting
currency and y is the new currency. For example, ‘10 Euros to Pound’ will return something like ‘10
Euros equal 8.9 British Pound’.
Using if statements, determine which conversion is appropriate. For example, a condition for an if
statement might find the first currency is in the Yen list and the second is in the Euro list, and if so, the
result should equal the original amount multiplied by .008.
Start your script with the comment #FirstName LastName Homework2 and save the file as
FirstNameLastNameHomework2.py. Both Part A and Part B should be included in one file. This will be
the file submitted to Blackboard.
Application example:
Part A (Example 1):
How much are you asking?
>>500
Ok, I would like to purchase it.
Part A (Example 2):
How much are you asking?
>>500.01
Sorry, that price is too high for me.
Part B:
Welcome to the currency calculator!
Enter the amount:
100
Enter the from currency:
dollar
Enter the to currency:
Euro
100.0 dollar(s) is worth 89.0 Euro(s)