Question: Create a class called CurrencyConverter.java, which will convert US dollars into either Pesos or Euros. 1. Store these two conversion rate as constant (final) variables.

Create a class called CurrencyConverter.java, which will convert US dollars into either Pesos or Euros.

1. Store these two conversion rate as constant (final) variables.

  • 1 US dollar = 19.14 Pesos
  • 1 US dollar = 0.88 Euros

2.Get the data from the user

  • In the main method, ask the user to enter the amount in US dollars that they want to convert
  • Then ask the user to enter the currencyType ("Euros" or "Pesos").

3. Determine the type of currency to convert

  • If the user entered "Euros" (ignoring case), then convert the amount to Euros.
  • If the user entered "Pesos" (ignoring case), then convert the amount to Pesos.
  • Using a while loop, If the user entered anything else, then tell the user to try again, and keep reading Strings until they enter a correct currency type.
  • If the user enters "Exit", then exit the program

4. Using a do-while loop, ask the user if they want to run the program again.

  • If the user enters "Yes" (ignoring case), the program should start over again and let you convert another amount
  • If the user enters "No" (ignoring case), the program should end

Create a class called CurrencyConverter.java, which will convert US dollars into either

Pesos or Euros. 1. Store these two conversion rate as constant (final)

Example Output 1: (user input is in green) Currency Converter How much money in US dollars do you have? 3.50 Do you want to convert to Pesos or Euros? pesos $3.50 US Dollars-67.00 Pesos Do you want to run the currency converter program again? (Yes or No) Yes How much money in US dollars do you have? 17.23 Do you want to convert to Pesos or Euros? Euros $17.23 US Dollars-15.15 Euros Do you want to run the currency converter program again? (Yes or No) No Goodbye! Example Output 2: (user input is in green) Currency Converter How much money in US dollars do you have? 12.75 Do you want to convert to Pesos or Euros? Yen Sorry, but 'Yen' is not a valid currency type. Try again: Dinar Sorry, but'Dinar is not a valid currency type. Try again: Hong Kong Dollar Sorry, Sorry, but 'Hong Kong Dollar' is not a valid currency type. Try again: Exit Goodbye

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!