Question: Java swing The question :Currency Conversion (use swing components). Prompt a user to enter an amount in dollars. Output the conversions into euros, pounds and

Java swing

The question :Currency Conversion (use swing components). Prompt a user to enter an amount in dollars. Output the conversions into euros, pounds and rubles. Use the following conversions: pound - .64; euro - .91; ruble 61.73.

My code below does not compile. Please assist.

import javax.swing.JOptionPane; import java.text.DecimalFormat;

public class KMCurrencyConversionSwing { public static void main(String[] args) { // declare and construct variables

double dollars, pounds, euros, rubles;

// Assigning Values pounds = 0.64; euros = 0.91; rubles = 61.73; DecimalFormat twoDigits = new DecimalFormat("####.00");

//print prompts and get input System.out.println("\tCurrency Conversion:");

dollars = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter the dollar amount:"));

// calculations

pounds = pounds * dollars; euros = euros * dollars; rubles = rubles * dollars;

// output JOptionPane.showMessageDialog(null, "YOUR DOLLAR AMOUNT OF " + twoDigits.format(dollars) + " is equal to " + twoDigits.format(euros) + " euros, " + twoDigits.format(pounds) + "pounds and " + twoDigits.format(rubles)+ "rubles." , "Currency Convertor",JOptionPane.PLAIN_MESSAGE);

System.exit(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!