Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

=+8. Why is productivity important?

Answered: 1 week ago

Question

=+ 9. What is inflation and what causes it?

Answered: 1 week ago