Write a JAVA program that helps the user convert currency. The user will enter t
ID: 3549869 • Letter: W
Question
Write a JAVA program that helps the user convert currency. The user will enter the amount in Kuwaiti dinars. The program will print the equivalent amount in US dollar and Euros count his change.
Assume that the exchange rate for US dollar is 3.54 and 2.59
Sample output:
Hello, welcome to Currency converter
How many Kuwaiti dinars you have? 15.5
15.5 KD is equal to 53.14 US dollars and 40.18Euro
Write a JAVA program that helps the user convert currency. The user will enter the amount in Kuwaiti dinars. The program will print the equivalent amount in US dollar and Euros count his changeExplanation / Answer
please rate - thanks
import java.util.*;
import javax.swing.*;
import java.lang.*;
import java.text.*;
public class converter
{
public static void main(String []args)
{DecimalFormat df = new DecimalFormat("#.##");
String input = JOptionPane.showInputDialog(null, "Hello, welcome to Currency converter. How many Kuwati dinars do you have? ");
double dinars=Double.parseDouble(input);
double dollars=dinars*3.54;
double euros=dinars*2.59;
JOptionPane.showMessageDialog(null,dinars+" KD is equal to "+df.format(dollars)+" US dollars and "+df.format(euros)+" Euro");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.