1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import  java.util.Scanner;
 
public  class  A02 {
 
     /**
      * @param args
      */
     public  static  void  main(String[] args) {
         // TODO Auto-generated method stub
         int  A[] =  new  int  []{ 245 , 570 , 320 };
         int  B[] =  new  int  []{ 2 , 1 , 1 };
         Scanner input =  new  Scanner (System.in);
         System.out.println( "***********消费单***********" );
         System.out.println( "购买物品\t单价\t个数\t金额" );
         System.out.println( "T恤\t" + "¥" +A[ 0 ]+ "\t" +B[ 0 ]+ "\t" +(A[ 0 ]*B[ 0 ]));
         System.out.println( "网球鞋\t" + "¥" +A[ 1 ]+ "\t" +B[ 1 ]+ "\t" +(A[ 1 ]*B[ 1 ]));
         System.out.println( "网球拍\t" + "¥" +A[ 2 ]+ "\t" +B[ 2 ]+ "\t" +(A[ 2 ]*B[ 2 ]));
         System.out.println( "\n折扣\t8折" );
         double  sum=((A[ 0 ]*B[ 0 ])+(A[ 1 ]*B[ 1 ])+(A[ 2 ]*B[ 2 ]))* 0.8 ;
         System.out.println( "消费总金额:¥" +sum);
         System.out.print( "实际交费:" );
         double  pay=input.nextDouble();
         System.out.println( "找钱:¥" +(pay-sum));
         System.out.println( "本次购物积分:" +( int ) sum/ 33 );
     }
 
}