x = 29.9
y = 354
z = 18.80
is there any way i can format them to:
x = 29.90
y = 354.00
z = 18.80
dealing in dollars...
Printable View
x = 29.9
y = 354
z = 18.80
is there any way i can format them to:
x = 29.90
y = 354.00
z = 18.80
dealing in dollars...
Code:import java.util.Locale;
import java.text.NumberFormat;
public class B{
public static void main(String[] args){
double x = 29.9;
NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
System.out.println(nf.format(x));
NumberFormat nf2 = NumberFormat.getCurrencyInstance(Locale.JAPAN);
System.out.println(nf2.format(x));
NumberFormat nf3 = NumberFormat.getCurrencyInstance(Locale.GERMANY);
System.out.println(nf3.format(x));
}
}
quipy. you should go through some of your threads that you posted and add {resolved} to the title if the you happened to figure out the problem either on your own or by the help of another member. It's just helps people who are browsing the forum to see what posts have been answered already. I also went through some of my threads and added resolved to the ones that i either figured out or got an answer to. :)