zoukankan      html  css  js  c++  java
  • 收银员收款程序

    》题目要求:

      》》编写一个收银柜台收款程序。
        》》》要求:接收用户输入的商品单价、购买数量以及用户付款的金额
        》》》计算并输出八折以后的商品金额和找零

    》程序实现

     1 package cn.fury.test;
     2 
     3 import java.util.Scanner;
     4 
     5 public class Test{
     6     public static void main(String[] args) {
     7         Scanner sc = new Scanner(System.in);
     8         System.out.println("Please input the quantity of your goods:");
     9         int quantity = sc.nextInt();
    10         System.out.println("Please input the price of your goods:");
    11         float price = sc.nextFloat();
    12         System.out.println("Please input the payment amount:");
    13         float payment_amount = sc.nextFloat();
    14         System.out.println("The money that you should pay is :" + price * quantity);
    15         System.out.println("The money that the salesclerk should return you: " + (payment_amount - price * quantity));
    16     }
    17 }
    View Code

    》程序改进方案:

      》》收银员可以输入多种商品,输入end时表示结束输入

      》》依次输入每种商品的价格,输入前提示是什么商品

      》》计算所有商品的总金额

      》》根据总金额决定折扣,100以下不打折,如果超过100就打8折,超过200就打7折,300以上打6折

      》》返回打折后的总金额以及找零金额

      》》notice : 待优化中......

  • 相关阅读:
    Centos 8 部署harbor 访问502
    selenium学习记录
    shell基础
    抓取人民日报
    caffe在笔记本ubuntu10.04 64位下的无GPU安装
    【转】HMM
    typedef 的一些用法
    j2ee 使用tomcat开发网站需要访问中文名的资源遇到的问题解决方案。。
    解决lex.yy.c文件在vs2012下编译生成exe
    python学习
  • 原文地址:https://www.cnblogs.com/NeverCtrl-C/p/6099440.html
Copyright © 2011-2022 走看看