1.
//头部
System.out.println("------------购买的水果信息------------");
System.out.println("水果编号"+" "+"水果名称"+" "+"水果单价"+" "+"计价单位"+" "+"品质"+" "+"购买数量");
//中部 变量
int bananaNumber = 1;
int appleNumber = 2;
int orangeNumber = 3;
String bananaName = "香蕉";
String appleName = "苹果";
String orangeName = "橙子";
String unit = "公斤";
double bananaPrice = 8.0;
double applePrice = 6.5;
double orangePrice = 9.0;
char bananaQuality = 'A';
char appleQuality = 'B';
char orangeQuality = 'A';
int bananaSaleNumber = 5;
int appleSaleNumber = 3;
int orangeSaleNumber = 4;
System.out.println( bananaNumber+" "+bananaName+" "+bananaPrice+" "+unit+" "+bananaQuality+" "+bananaSaleNumber );
System.out.println( appleNumber+" "+appleName+" "+applePrice+" "+unit+" "+appleQuality+" "+appleSaleNumber );
System.out.println( orangeNumber+" "+orangeName+" "+orangePrice+" "+unit+" "+orangeQuality+" "+orangeSaleNumber );
double totalPrice = bananaPrice*bananaSaleNumber+applePrice*appleSaleNumber+orangePrice*orangeSaleNumber;
System.out.println("您购买的水果总金额为:"+totalPrice+"元");
2.
//头部
System.out.println("------------传智播客鲜花店------------");
System.out.println("鲜花编号"+" "+"鲜花名称"+" "+"鲜花颜色"+" "+"鲜花单价"+" "+"购买数量");
//中部 变量
int lilyNumber = 1;
int roseNumber = 2;
int carnationNumber = 3;
String lilyName = "百合";
String roseName = "玫瑰";
String carnationName = "康乃馨";
String lilycolor = "白色";
String rosecolor = "红色";
String carnationcolor = "粉红色";
double lilyPrice = 8.0;
double rosePrice = 6.0;
double carnationPrice = 4.0;
int lilySaleNumber = 100;
int roseSaleNumber = 999;
int carnationSaleNumber = 36;
System.out.println( lilyNumber+" "+lilyName+" "+lilycolor+" "+lilyPrice+" "+lilySaleNumber );
System.out.println( roseNumber+" "+roseName+" "+rosecolor+" "+rosePrice+" "+roseSaleNumber );
System.out.println( carnationNumber+" "+carnationName+" "+carnationcolor+" "+carnationPrice+" "+carnationSaleNumber );
double totalPrice = lilyPrice*lilySaleNumber+rosePrice*roseSaleNumber+carnationPrice*carnationSaleNumber;
System.out.println("您购买的鲜花总金额为:"+totalPrice+"元");
3.
//头部
System.out.println("------------传智播客超市------------");
System.out.println("商品编号"+" "+"商品名称"+" "+"生产厂家"+" "+"商品单价"+" "+"购买数量");
//中部 变量
int lilyNumber = 1;
int roseNumber = 2;
int carnationNumber = 3;
String lilyName = "可乐";
String roseName = "冰红茶";
String carnationName = "脉动";
String lilycolor = "百事";
String rosecolor = "康师傅";
String carnationcolor = "乐百氏";
double lilyPrice = 3.0;
double rosePrice = 2.5;
double carnationPrice = 4.0;
int lilySaleNumber = 6;
int roseSaleNumber = 5;
int carnationSaleNumber = 12;
System.out.println( lilyNumber+" "+lilyName+" "+lilycolor+" "+lilyPrice+" "+lilySaleNumber );
System.out.println( roseNumber+" "+roseName+" "+rosecolor+" "+rosePrice+" "+roseSaleNumber );
System.out.println( carnationNumber+" "+carnationName+" "+carnationcolor+" "+carnationPrice+" "+carnationSaleNumber );
double totalPrice = lilyPrice*lilySaleNumber+rosePrice*roseSaleNumber+carnationPrice*carnationSaleNumber;
System.out.println("您购买的商品总金额为:"+totalPrice+"元"); |
|