zoukankan      html  css  js  c++  java
  • 1.第一个java程序

    public class Main {
    public static void main(String[] args){
    int shirtPrice=245;//Tshirt价格
    int shoePrice =570;//网球鞋价格
    int padPrice=320;//拍子的价格
    int shirtNo=2;//T恤衫数量
    int shoeNo=1;
    int padNo=1;
    double discount=0.8;//折扣,这个discount用来下面乘。
    /*计算消费总金额 */
    double finalPay=(shirtPrice*shirtNo + shoePrice*shoeNo+padPrice*padNo)*discount;
    double zl=(1500 - finalPay);
    int jifen= (int) (finalPay *3 / 100);//准备输出
    System.out.println("*********消费单*********");
    System.out.println("购买物品"+"\t"+"单价(¥)"+"\t"+"个数"+"\t"+"金额");
    System.out.println("T恤衫 "+"\t¥"+shirtPrice+" \t"+shirtNo+" \t"+shirtPrice*shirtNo);
    System.out.println("网球鞋 "+"\t¥"+shoePrice+" \t"+shoeNo+" \t"+shoePrice*shoeNo);
    System.out.println("拍子 "+"\t¥"+padPrice+" \t"+padNo+" \t"+padPrice*padNo+" \n");
    System.out.println("折扣"+" \t"+discount*10+"折");
    System.out.println("消费总金额:"+" \t¥"+finalPay);
    System.out.println("顾客付款:1500,找零"+ zl);
    System.out.println("本次购物获得积分:"+jifen);
    }
    }


    写的第一个程序,刚才不知道为什么没有发布成功~

  • 相关阅读:
    例3-7 统计字符
    大一第四周
    例3-5 四则运算
    MyBatis 查询缓存
    MyBatis 延迟加载
    Mybatis 关联查询
    Mybatis 动态SQL
    MyBatis mapper动态代理
    MyBatis 增删改查
    MyBatis 框架搭建
  • 原文地址:https://www.cnblogs.com/qobin/p/2274836.html
Copyright © 2011-2022 走看看