Question

In: Computer Science

You are back from world tour visiting many countries. You have money in various currencies. Write...

You are back from world tour visiting many countries. You have money in various currencies. Write a program to come up with how much money it will all amount to in USD. So if user entered they have 10 as the value of Euros they have, then the equivalent $ value would be 10 EUR = 11.0501 USD if it is 09/09/2019 conversion rate of 1 USD = 0.904968 EUR Use the conversion rates given below in the list - do not change it to today's values conversionRate = [ [“EUR”, 0.85, "Euro"], [“GBP”, 0.76, "British pounds"], [“INR”, 71.96, "Indian Rupees"], [“AUD”, 1.39, "Australian Dollars"], [“JPY”, 111.35, "Japanese Yen" ], [“CNY”, 6.84, "Chinese Yuan"] ] Prompt the user to enter how much do they have of each currency given in the list conversionRate. (If user doesn’t have a specific currency, advise the user to enter 0).

After getting entries for all currency types in the list, convert each of those into USD and print the total value in USD.

Please enter 0 if you do not possess a particular currency
How much do you have in EURO ? 10
How much do you have in British pounds ? 10
How much do you have in Indian Rupees ? 2000
How much do you have in Australian Dollars ? 20
How much do you have in Japanese Yen ? 10
How much do you have in Chinese Yuan ? 10

Total amount after conversion is 68.65 USD
Please enter 0 if you do not possess a particular currency
How much do you have in EURO ? 10
How much do you have in British pounds ? 10
How much do you have in Indian Rupees ? 0
How much do you have in Australian Dollars ? 0
How much do you have in Japanese Yen ? 10
How much do you have in Chinese Yuan ? 10

***PYTHON*** PLEASE

Solutions

Expert Solution

Complete Code:

Sample Output:

CODE TO COPY:

#list of conversion rates
conversionRate = [ ["EUR", 0.85, "Euro"], ["GBP", 0.76, "British pounds"],
                   ["INR", 71.96, "Indian Rupees"], ["AUD", 1.39, "Australian Dollars"],
                   ["JPY", 111.35, "Japanese Yen" ], ["CNY", 6.84, "Chinese Yuan"] ]

#prompt the user to enter how much do they have of each currency
print("Please enter 0 if you do not possess a particular currency")
eur = float(input("How much do you have in EURO ? "))
gbp = float(input("How much do you have in British pounds ? "))
inr = float(input("How much do you have in Indian Rupees ? "))
aud = float(input("How much do you have in Australian Dollars ? "))
jpy = float(input("How much do you have in Japanese Yen ? "))
cny = float(input("How much do you have in Chinese Yuan ? "))

#convert each currency into USD using the entries for currency types in the list
eurUSD = eur/conversionRate[0][1]
gbpUSD = gbp/conversionRate[1][1]
inrUSD = inr/conversionRate[2][1]
audUSD = aud/conversionRate[3][1]
jpyUSD = jpy/conversionRate[4][1]
cnyUSD = cny/conversionRate[5][1]

#compute the total value in USD
totalUSD = eurUSD + gbpUSD + inrUSD + audUSD + jpyUSD + cnyUSD

#print the total value in USD
print("\nTotal amount after conversion is %.2f USD" % (int(totalUSD * 100)/100))


Related Solutions

Part of international trade involves countries using their money to purchase other countries currencies, invest in...
Part of international trade involves countries using their money to purchase other countries currencies, invest in their stock markets, and purchase financial products such as US treasuries (bonds, debt). In August 2002, a private lawsuit was filed in U.S. courts which sought to seize over $1 trillion worth of Saudi Arabian and other Middle Eastern assets in the United States as compensation for terrorist attacks. If the lawsuit would have been successful, how would that have affected future foreign investment...
In the real world, countries that have faster money growth over the long run tend to...
In the real world, countries that have faster money growth over the long run tend to have a lower government budget deficits over the long run b higher inflation over the long run c lower inflation over the long run d lower nominal interest rates over the long run
1. The World Bank is concerned about depreciating currencies in developing countries (typically SOEs). What fiscal...
1. The World Bank is concerned about depreciating currencies in developing countries (typically SOEs). What fiscal policy should the Bank advise large foreign countries (that have influence on the world market of loanable funds) to implement in order to reverse the exchange rate depreciation (want ↑e) of the SOEs? For simplicity, assume that the SOE is Mexico and that the large foreign country is the U.S.. The exchange rate e = US$/Peso. Answer the following questions. a. According to the...
Provide reasoning for why highly inflated countries tend to have weak home currencies
Provide reasoning for why highly inflated countries tend to have weak home currencies
Why do highly inflated countries such as Brazil tend to have weak home currencies?
Why do highly inflated countries such as Brazil tend to have weak home currencies?
With the many local smaller special unique cultures around the world in many countries of all...
With the many local smaller special unique cultures around the world in many countries of all sizes: with globalization, should these small local cultures be protected from globalization? Why yes? Why no?
Research data on the number of computers per capita in various countries of the world. Show...
Research data on the number of computers per capita in various countries of the world. Show how a newspaper could present the data in a way that misleads readers into believing that Canada is far behind other countries.
A World Health Organization study (the MONICA project) of health in various countries reported that in...
A World Health Organization study (the MONICA project) of health in various countries reported that in Canada, systolic blood pressure readings have a mean of 115 and a standard deviation of 13. A reading above 147 is considered to be high blood pressure. (a) How many standard deviations away from the mean is a blood pressure reading of 147? z = (3 decimal places) (b) If systolic blood pressure in Canada is approximately normal, find the proportion of Canadians that...
The most obese countries in the world have obesity rates that range from 11.4% to 74.6%....
The most obese countries in the world have obesity rates that range from 11.4% to 74.6%. This data is summarized in the following table. Percent of Population Obese Number of Countries 11.4–20.45 28 20.45–29.45 14 29.45–38.45 4 38.45–47.45 0 47.45–56.45 4 56.45–65.45 2 65.45–74.45 0 74.45–83.45 1 (a) What is the best estimate of the average obesity percentage for these countries? (Round your answer to two decimal places.) (b) The United States has an average obesity rate of 33.9%. Is...
1.) The most obese countries in the world have obesity rates that range from 11.4% to...
1.) The most obese countries in the world have obesity rates that range from 11.4% to 74.6%. This data is summarized in the following table. Percent of Population Obese Number of Countries 11.4–20.45 29 20.45–29.45 13 29.45–38.45 4 38.45–47.45 0 47.45–56.45 2 56.45–65.45 1 65.45–74.45 0 74.45–83.45 1 What is the best estimate of the average obesity percentage for these countries? The United States has an average obesity rate of 33.9%. Is this rate above average or below? How does...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT