| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我是新手,大家能否看看这个程序,说RunTime errorimport java.text.DecimalFormat;
import java.util.*;
public class acm {
public static void main(String args[]) throws Exception {
float[] a = new float[12];
float j = 0;
for (int i = 0; i < 12; i++) {
Scanner cin = new Scanner(System.in);
a[i] = cin.nextFloat();
j = a[i] + j;
}
j = j / 12;
DecimalFormat formatter = new DecimalFormat("#.00");
Currency currency = Currency.getInstance(Locale.US);
String symbol = currency.getSymbol(Locale.US);
String r = formatter.format(j);
System.out.print(symbol + r);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator