第一天学Java,希望不会倒在路上

在这里插入图片描述import java.util.Scanner;

/1.显示商品单价
2.输入商品个数并统计总价
3.商品大8折算出金额
4.输入实际付款金额
5.输出找零
/
public class 真课后作业 {
public static void main(String[]args){
/1.显示商品单价/
System.out.println("*********\t"+“商品目录”+"\t *********");
int T = 150;
System.out.println("\t商品名:T袖:\tKaTeX parse error: Expected 'EOF', got '\t' at position 47: …m.out.println("\̲t̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲ ̲"+"小背包:\t"+xbao);
int wow = 99999;
System.out.println("\t "+“艾泽拉斯精华:\t " + w o w + " ( 非 卖 品 ) " ) ; / ∗ 2. 输 入 商 品 个 数 ∗ / S c a n n e r i n p u t = n e w S c a n n e r ( S y s t e m . i n ) ; S y s t e m . o u t . p r i n t l n ( " 输 入 你 T 袖 购 买 的 数 目 : " ) ; i n t T n u m = i n p u t . n e x t I n t ( ) ; S y s t e m . o u t . p r i n t l n ( " 输 入 你 小 背 包 购 买 的 数 目 : " ) ; i n t x b a o n u m = i n p u t . n e x t I n t ( ) ; S y s t e m . o u t . p r i n t l n ( " 输 入 你 艾 泽 拉 斯 精 华 购 买 的 数 目 : " ) ; i n t w o w n u m = i n p u t . n e x t I n t ( ) ; / ∗ 3. 并 统 计 总 价 ∗ / d o u b l e z o n g = ( T n u m ∗ T ) + ( x b a o n u m ∗ x b a o ) + ( w o w n u m ∗ w o w ) ; S y s t e m . o u t . p r i n t l n ( " 你 的 消 费 : "+wow+"(非卖品)"); /*2.输入商品个数*/ Scanner input = new Scanner(System.in); System.out.println("输入你T袖购买的数目:"); int Tnum = input.nextInt(); System.out.println("输入你小背包购买的数目:"); int xbaonum = input.nextInt(); System.out.println("输入你艾泽拉斯精华购买的数目:"); int wownum = input.nextInt(); /*3.并统计总价*/ double zong = (Tnum*T)+(xbaonum*xbao)+(wownum*wow); System.out.println("你的消费: "+wow+"()");/2./Scannerinput=newScanner(System.in);System.out.println("T:");intTnum=input.nextInt();System.out.println(":");intxbaonum=input.nextInt();System.out.println(":");intwownum=input.nextInt();/3./doublezong=(TnumT)+(xbaonumxbao)+(wownumwow);System.out.println(":”+zong);
/4.商品打8折算出金额/
double zong2 = (zong
0.8);
System.out.println(“8折后你的消费为:$”+zong2);
/5.输入实际付款金额/
System.out.println(“输入你的付款金额:”);
int money = input.nextInt();
if (zong >= 99999){
System.out.println(“冤大头想买也不是不行”);
}
/6.输出找零/
double ling = (money - zong2);
System.out.println(“你的找零:”+ling);
}
}

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值