import java.util.Scanner; public class ShopMoney { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("☆☆☆☆购物金额☆☆☆☆☆"); Scanner n=new Scanner(System.in); float goods []=new float[5]; float zongjine=0; for(int i=0;i<goods.length;i++){ System.out.println("请输入第"+i+"笔购物金额:"); goods [i]=n.nextFloat(); } System.out.println(" 序号 金额(元)"); for(int i=0;i<goods.length;i++){ System.out.print(i); System.out.print(" "+goods[i]+" "); zongjine=zongjine+goods[i]; } System.out.println("总金额 "+zongjine); n.close(); } }