package day3;
import java.util.Scanner;
public class demo3 {
public static void main(String[] args) {
int money = 10000;
String s = "";
while (true) {
System.out.println("-------------------家庭收支记账软件-----------------");
System.out.println(" 1.收支明细 ");
System.out.println(" 2.登记收入 ");
System.out.println(" 3.登记支出 ");
System.out.println(" 4.退出 ");
System.out.println(" 请选择(1-4): ");
Scanner m = new Scanner(System.in);
e:while (true) {
int a = m.nextInt();
switch (a) {
case 1:
System.out.println("收支明细");
System.out.println(s);
break;
case 2:
System.out.println("登记收入");
int income = m.nextInt();
System.out.println("本次收入金额:" + income);
System.out.println("本次收入说明: 工资");
money += income;
s += "收入: " + income + "工资" + " 现总金额: " + money + "\n";
break;
case 3:
System.out.println("登记支出");
int input = m.nextInt();
System.out.println("本次支出金额:" + input);
System.out.println("本次支出说明: 物业费");
money -= input;
s += "支出: " + input + "物业费" + " 现总金额: " + money;
break;
case 4:
System.out.println("退出");
break e;
default:
System.out.println("输入的选项错误,请重新输入!");
}
}
}
}
}