当前位置:网站首页>Easy change
Easy change
2022-07-04 05:19:00 【fanlangke】
source : oracle Zero basis 30 Heaven Society Java
SmallChangeSysAPP
package com.hspedu.smallchange.oop;
import com.hspedu.smallchange.SmallChangeSys;
public class SmallChangeSysAPP {
public static void main(String[] args) {
new SmallChangeSysOOP().mainMenu();
}
}
SmallChangeSysOOP
package com.hspedu.smallchange.oop;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class SmallChangeSysOOP {
boolean loop = true;
Scanner scanner = new Scanner(System.in);
String key = "";
String details = "---------- Change details ----------";
double money = 0;
double balance = 0;
Date date = null;
String note = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
public void mainMenu() {
do {
System.out.println("========== Zero money ==========");
System.out.println("\t\t\t1 Change details ");
System.out.println("\t\t\t2 Income entry ");
System.out.println("\t\t\t3 consumption ");
System.out.println("\t\t\t4 sign out ");
System.out.println(" Please select (1-4):");
this.key = this.scanner.next();
switch (this.key) {
case "1":
this.detail();
break;
case "2":
this.income();
break;
case "3":
this.pay();
break;
case "4":
this.exit();
break;
default:
System.out.println(" Wrong choice , Please reselect ");
}
}while(loop);
System.out.println("----- Quit the change project -----");
}
public void detail(){
System.out.println(details);
}
public void income(){
System.out.println(" The recorded amount of income :");
money=scanner.nextDouble();
if(money<0){
System.out.println(" Income entry amount cannot be less than 0");
return;
}
balance+=money;
date =new Date();
details+="\n Income entry \t+"+money+"\t"+sdf.format(date);
}
public void pay(){
System.out.println(" Consumption amount :");
money=scanner.nextDouble();
if(money<0||money>balance){
System.out.println(" Income entry amount cannot be less than 0");
return;
}
System.out.println(" Consumption description :");
note=scanner.next();
balance-=money;
date =new Date();
details+="\n"+note+"\t-"+money+"\t"+sdf.format(date);
}
public void exit(){
String choice="";
while(true){
System.out.println(" Are you sure you want to quit ?y/n");
choice=scanner.next();
if(choice.equals("y")||choice.equals("n")){
break;
}
}
if(choice.equals("n")){
return ;
}
loop=false;
return ;
}
}
边栏推荐
- flink1.13 sql基础语法(二)join操作
- Roles of rollup components
- Etcd database source code analysis - initialization overview
- Daily question brushing record (12)
- ETCD数据库源码分析——初始化总览
- 2022 t elevator repair operation certificate examination question bank and simulation examination
- Rollup各组件作用
- The first introduction, stages and methods of defense system breakthrough from the perspective of the red team
- Public inputs in appliedzkp zkevm (13)
- RSA加密应用常见缺陷的原理与实践
猜你喜欢

抓包整理外篇fiddler———— 会话栏与过滤器

Character types of C language
![[interested reading] advantageous filtering modeling on long term user behavior sequences for click through rate pre](/img/3e/b5df691ca1790469eb1b4e8ea5b4c0.png)
[interested reading] advantageous filtering modeling on long term user behavior sequences for click through rate pre

定制一个自己项目里需要的分页器

Notes on the paper "cross view transformers for real time map view semantic segmentation"

令人头痛的延时双删

Daily question brushing record (12)

如何构建属于自己的知识引擎?社群开放申请
![[paper summary] zero shot semantic segmentation](/img/78/ee64118d86a7e43ec4d1cb97191fbe.jpg)
[paper summary] zero shot semantic segmentation

VB.net 简单的处理图片,黑白(类库——7)
随机推荐
[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk
Programming example of stm32f1 and stm32subeide -74hc595 drives 4-bit 7-segment nixie tube
力扣 第 300 场周赛
[matlab] general function of communication signal modulation inverse Fourier transform
2022危险化学品经营单位安全管理人员上岗证题库及答案
[matlab] matlab simulation - narrow band Gaussian white noise
[matlab] matlab simulates digital bandpass transmission systems - QPSK and OQPSK systems
如何使用postman实现简单的接口关联【增删改查】
Simple g++ and GDB debugging
[matlab] matlab simulation - simulate the AM modulation process of the modulation system
Zhongke panyun-2022 Guangdong Trojan horse information acquisition and analysis
中科磐云—数据分析与取证数据包flag
Analysis of classical pointer and array written test questions in C language
cmake
Flutter ‘/usr/lib/libswiftCore. dylib‘ (no such file)
laravel 中获取刚刚插入的记录的id
远程桌面客户端 RDP
Flutter calls Gaode map app to realize location search, route planning and reverse geocoding
Flask
2022 t elevator repair operation certificate examination question bank and simulation examination