2020-10-26

学习java的第三天


昨天老师讲了一个小案例,一个记账系统,因为是基础知识他讲的很快,涉及到了线程问题,这是我最不会的地方,老师也没深入讲,所以我没办法,只好用了MySQL数据库来做记账本,感觉有了druid还有dbutils这外外部库之后编程简单了好多,虽然我用的不是很熟练,ok!看代码

public static void main(String args[])
	{
		TestAccounts ta=new TestAccounts();
		int choice=0,choice1=0;
		double income=0,spending=0,balance=0;
		Scanner first=new Scanner(System.in);
		Scanner second=new Scanner(System.in);
		for (int i = 1;i>0 ; i++) {
			System.out.println();
			System.out.println();
			System.out.println("                         家庭记账系统     ");
			System.out.println("                              ");
			System.out.println("                         1.查询账单     ");
			System.out.println("                         2.记账     ");
			System.out.println("                         3.退出系统     ");
			choice = first.nextInt();
			if (choice==1) {
				ta.testQuery1();
			}
			else if (choice==2) {
				System.out.println("                         1.改收入    ");
				System.out.println("                         2.改支出     ");
				choice1=second.nextInt();
				if (choice1==1) {
					System.out.print("你收入了:");
					income=second.nextDouble();
					balance=balance+income-spending;
					ta.testInsert(income, spending, balance);
					income=0;
					spending=0;
					
				}
				else if (choice1==2) {
					System.out.print("你支出了:");
					spending=second.nextDouble();
					balance=balance+income-spending;
					ta.testInsert(income, spending, balance);
					income=0;
					spending=0;
				}
				else {
					System.out.println("你号没了");
					break;
				}
			}
			
			
			else if (choice==3) {
				System.out.println("是否确认退出<1/0>");
				choice=first.nextInt();
				if (choice==1) {
					break;
				}
				else {
					continue;
				}
			}
			else {
				System.out.println("你号没了");
				break;
			}
			
			
		}
		first.close();
		second.close();
	
	}

别的类的代码我没放上去了,有需要的可以私聊,作完才发现我这个记账只能记不能删,感觉麻烦就没加上去了,可能大概删除记录的话回滚一下就好了吧。。。应该吧

还有一个问题!有没有那位大哥告诉我我怎么导入javaEE的插件呀!!!

东风夜放花千树,更吹落星如雨。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值