public class Pay {
public static void main(String[] args){
int shirtPay = 245; //T恤价格
int shoePay = 570; //网球鞋价格
int padPay = 320; //网球拍价格
int shirtNo = 2; //T恤件数
int shoeNo = 1; //网球鞋数目
int padNo = 1; //网球拍数目
double discount = 0.8;
double finalPay = (shirtPay*shirtNo + shoePay*shoeNo + padPay*padNo)*discount;
double pay = (shirtPay*shirtNo + shoePay*shoeNo + padPay*padNo);
double rest = pay- finalPay;
int score = (int)finalPay*3/100;
System.out.println("消费总金额:" + finalPay);
System.out.println("实际交费:" + pay);
System.out.println("找钱:" + rest);
System.out.println("本次购物所获的积分是:" + score);
System.out.println(" ");
//打印购物单
System.out.println("***********************消费单*************************");
System.out.println("购买物品\t 单价\t 个数\t 金额\t");
System.out.println("T恤\t $245\t 2\t $490");
System.out.println("网球鞋\t $570\t 1\t $570 ");
System.out.println("网球拍\t $320\t 1\t $320");
System.out.println(" ");
System.out.println("折扣\t8折\n消费总金额\t$1104.0\n实际交费\t$1380.0\n找钱\t$276.0\n本次购物所获得的积分是:33");
}
}
消费总金额:1104.0
实际交费:1380.0
找钱:276.0
本次购物所获的积分是:33
***********************消费单*************************
购买物品 单价 个数 金额
T恤 $245 2 $490
网球鞋 $570 1 $570
网球拍 $320 1 $320
折扣 8折
消费总金额 $1104.0
实际交费 $1380.0
找钱 $276.0
本次购物所获得的积分是:33