Question: Hello, need some help. I need to convert the output from JOptionPane to System.out.println. Thanks in advance! import javax.swing.JOptionPane; public class CurrencyConversion { static String[]

Hello, need some help. I need to convert the output from JOptionPane to System.out.println.

Thanks in advance!

import javax.swing.JOptionPane; public class CurrencyConversion { static String[] currenyCode = { "USD", "YEN", "EURO" }; public static void main(String args[]) { double fromamount =0; double amount=0; Object code = JOptionPane .showInputDialog(null, "Select Currency", "Currency Code", JOptionPane.QUESTION_MESSAGE, null, currenyCode, currenyCode[0]); try{ fromamount = Double.parseDouble(JOptionPane .showInputDialog("Enter the amount of that currency")); }catch(NumberFormatException ex){ JOptionPane.showMessageDialog(null, "Use only numeric amounts"); fromamount = Double.parseDouble(JOptionPane .showInputDialog("Re-Enter the amount")); } Object convertTo = JOptionPane .showInputDialog(null, "Select Conversion Code", "Converted Currency Code", JOptionPane.QUESTION_MESSAGE, null, currenyCode, currenyCode[0]); if (code.equals("USD") && convertTo.equals("EURO")) { amount = fromamount * .90; } else if (code.equals("USD") && convertTo.equals("YEN")) { amount = fromamount * 123.14; } else if (code.equals("EURO") && convertTo.equals("USD")) { amount = fromamount * 1.11; } else if (code.equals("YEN") && convertTo.equals("USD")) { amount = fromamount * 0073; } else if (code.equals("YEN") && convertTo.equals("EURO")) { amount = fromamount * .0081; } else if (code.equals("EURO") && convertTo.equals("YEN")) { amount = fromamount * 136.08; } System.out.println(null, fromamount + " "+code +" is equal to" + amount + " "+convertTo); } } 

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!