IO-01. 表格输出

本题要求编写程序,按照规定格式输出表格。

输入格式:

本题目没有输入。

输出格式:

要求严格按照给出的格式输出下列表格:

------------------------------------

Province      Area(km2)   Pop.(10K)

------------------------------------

Anhui         139600.00   6461.00

Beijing        16410.54   1180.70

Chongqing      82400.00   3144.23

Shanghai        6340.50   1360.26

Zhejiang      101800.00   4894.00

------------------------------------
/*
//我的输出也没问题啊,为啥不通过?! public class Main { public static void main(String[] args) { String t[]={"Province","Area(km2)","Pop.(10K)"}; String a[]={"Anhui","Beijing","Chongqing","Shanghai","Zhejiang"}; Float b[]={139600f,16410.54f,82400f,6340.5f,101800f}; Float c[]={6461f,1180.7f,3144.23f,1360.26f,4894f};
System.out.println("------------------------------------");  System.out.printf("%-14s%9s%12s%n",t[0],t[1],t[2]);  System.out.println("------------------------------------"); for(int i=0;i<5;i++ ) { System.out.printf("%-14s%9.2f%10.2f%n",a[i],b[i],c[i]); } System.out.print("------------------------------------"); } }
*/ /*下面这个很无语!但是能通过。。。*/ public class Main { public static void main(String[] args) { System.out.println("------------------------------------"); System.out.println("Province Area(km2) Pop.(10K)"); System.out.println("------------------------------------"); System.out.println("Anhui 139600.00 6461.00"); System.out.println("Beijing 16410.54 1180.70"); System.out.println("Chongqing 82400.00 3144.23"); System.out.println("Shanghai 6340.50 1360.26"); System.out.println("Zhejiang 101800.00 4894.00"); System.out.println("------------------------------------"); } }

 

你可能感兴趣的:(IO)