日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

收银

發布時間:2024/3/13 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 收银 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

import java.math.BigDecimal;
import java.util.Scanner;
public class 收銀系統方法 {
static Scanner scanner = new Scanner(System.in);
static double quantity;// 商品數量
static double price;// 商品單價
static double payment;// 用戶支付金額
static double change;// 找零
static double payable = 0;// 應付金額
static int Payment = 0;// 支付方式
static int strokeCount = 0;// 現金收銀筆數
static int strokeCount1 = 0;// 微信收銀筆數
static int strokeCount2 = 0;// 支付寶收銀筆數
static int strokeCount3 = 0;// 刷卡收銀筆數
static double toCollectMoney = 0;// 現金收銀金額;
static double toCollectMoney1 = 0;// 微信收銀筆數
static int toCollectMoney2 = 0;// 支付寶收銀筆數
static int toCollectMoney3 = 0;// 刷卡收銀筆數
static int number = 0;// 訂單總數
static double totalSum = 0;// 總額
static int inquire;// 選擇收銀或查詢
public static void main(String[] args) {
while (true) {
System.out.println(“歡迎使用天天收銀系統\n” + “請選擇你需要的業務\n” + “1.收銀 2.查看今日各支付筆數及收銀金額”);
inquire = scanner.nextInt();
if (inquire == 2) {
System.out.println(“歡迎使用查詢業務”);
pain();
}
System.out.println(“謝謝使用本系統”);
while (true) {
if(Payment6) {
return;
}
System.out.println(“歡迎使用收銀業務”);
System.out.println(“請輸入商品單價”);
price = scanner.nextDouble();
if (price == 0) {
break;
}
System.out.println(“請輸入商品數量”);
quantity = scanner.nextDouble();
System.out.println(“選擇支付方式:1.現金,2.微信,3.支付寶,4.刷卡”);
Payment = scanner.nextInt();
switch (Payment) {
case 1:
toCollectMoney += price * quantity;
strokeCount += 1;
publi(Payment, price, quantity);
break;
case 2:
toCollectMoney1 += price * quantity;
strokeCount1 += 1;
publi(Payment, price, quantity);
break;
case 3:
toCollectMoney2 += price * quantity;
strokeCount2 += 1;
publi(Payment, price, quantity);
break;
case 4:
toCollectMoney3 += price * quantity;
strokeCount3 += 1;
publi(Payment, price, quantity);
break;
default:
break;
}
}
}
}
public static void publi(int payme, double price1, double quantity1) {
payable = price1 * quantity1;
System.out.println(“應付金額” + payable);
System.out.println(“請輸入支付金額”);
payment = scanner.nextDouble();// 輸入金額
change = payment - payable;
BigDecimal b = new BigDecimal(change);
change = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
System.out.println(“支付金額:” + payment + “\n應付金額:” + payable + “\n找零金額” + change);
System.out.println(“感謝您的本次消費,祝您生活愉快!”);
}
public static void pain() {
while (true) {
System.out.println(“查看今日各支付筆數及金額\n1.現金,2.微信,3.支付寶,4.刷卡,5.營業總額”);
Payment = scanner.nextInt();
if(Payment6) {
return;
}
switch (Payment) {
case 1:
System.out.println(“現金支付筆數” + strokeCount + “金額為” + toCollectMoney);
break;
case 2:
System.out.println(“現金支付筆數” + strokeCount1 + “金額為” + toCollectMoney1);
break;
case 3:
System.out.println(“現金支付筆數” + strokeCount2 + “金額為” + toCollectMoney2);
break;
case 4:
System.out.println(“現金支付筆數” + strokeCount3 + “金額為” + toCollectMoney3);
break;
case 5:
number = strokeCount + strokeCount1 + strokeCount2 + strokeCount3;
totalSum = toCollectMoney + toCollectMoney1 + toCollectMoney2 + toCollectMoney3;
System.out.println(“總筆數” + number + “總金額為” + totalSum);
break;
default:
break;
}
}
}
}

總結

以上是生活随笔為你收集整理的收银的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。