Question: Can you check where I went wrong with this code? Thanks. We are focusing on methods for this chapter. The conversion is done this way

 Can you check where I went wrong with this code? Thanks.

Can you check where I went wrong with this code? Thanks. We are focusing on methods for this chapter. The conversion is done this way because we are only allowed to use the basics, which means we can't use java.util.currency.

CODE BELOW (what i have so far):

public static double dollarstoeuros (double euros) { double dollars = 0.81 * euros; return euros; } public static double eurostodollars (double dollars) { double euros = dollars / 0.81; return dollars; } public static double dollarstopesos (double pesos) { double dollars = 18.64 * pesos; return pesos; } public static double pesostodollars (double dollars) { double pesos = dollars / 18.64; return dollars; } public static double eurostopesos (double pesos) { double euros = 22.92 * pesos; return pesos; } public static double pesostoeuros (double euros) { double pesos = euros / 22.92; return euros; } public static void main(String[] args) { Scanner input = new Scanner (System.in); int transactionType; double euros, dollars, pesos; System.out.println("1 Convert Dollar to Euro"); System.out.println("2 Convert Euro to Dollar"); System.out.println("3 Convert Dollar to Peso"); System.out.println("4 Convert Peso to Dollar"); System.out.println("5 Convert Euro to Peso"); System.out.println("6 Convert Peso to Euro"); System.out.println("Please enter 1 - 6, your choice for Dollar, Euro, and Peso"); transactionType = input.nextInt(); switch (transactionType) { case 1: System.out.print("Number of dollars: "); dollars = input.nextDouble(); euros = dollarstoeuros(dollars*0.81); System.out.println("Number of euros: " + euros); break; case 2: System.out.print("Number of euros: "); euros = input.nextDouble(); dollars = eurostodollars(euros/0.81); System.out.println("Number of dollars: " +dollars); break; case 3: System.out.print("Number of dollars: "); dollars = input.nextDouble(); pesos = dollarstopesos(dollars*18.64); System.out.println("Number of pesos: " +pesos); break; case 4: System.out.print("Number of pesos: "); pesos = input.nextDouble(); dollars = pesostodollars(pesos/18.64); System.out.println("Number of dollars: " +dollars); break; case 5: System.out.print("Number of euros: "); euros = input.nextDouble(); pesos = eurostopesos(euros*22.92); System.out.println("Number of pesos: " +pesos); break; case 6: System.out.print("Number of pesos: "); pesos = input.nextDouble(); euros = pesostoeuros(pesos/22.92); System.out.println("Number of euros: " +euros); break; } } }

Write a method that displays a menu of 3 currency types prompting the user to choose the type of currency exchange s/he wants to conduct. Based on the user input your program will then prompt the user to input the amount s/he would like convert, then calculate and display the equivalent amount in the desired type of currency. Output: terminated> CurrencyExchage [Java Application]CProgram FilesJavaljdk1.8.0 1441binljavaw 1 Convert Dollar to Euro 2 Convert Dollar to Peso 3 Convert Euro to Dollar 4 Convert Peso to Dollar 5 Convert Euro to Peso 6 Convert Peso to Euro Pls enter 1 - 6, your choice for Dollar, Euro, and Peso Option 1 rate 1 Dollar0.81 Euro. Pls. enter USD$ 100.00 $100.0 81.0

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!