标签:info mamicode main min image 还需要 util bsp out
1.实验源代码
package zl6;
import java.util.Scanner;
public class Account{
String zhanghao,chuhuxingming,shenfenzhenghaoma;
double cunkuanyue=0,cunjin=0,quchu=0;
int year=0,month=0,day=0;
Scanner shuru=new Scanner(System.in);
void set(){
System.out.println("请依次输入账号、储户姓名、开户时间、身份证号码、存款余额:");
zhanghao=shuru.next();
chuhuxingming=shuru.next();
year=shuru.nextInt();
month=shuru.nextInt();
day=shuru.nextInt();
shenfenzhenghaoma=shuru.next();
cunkuanyue=shuru.nextDouble();
}
public void Cunkuan() {
System.out.println("请输入要存入多少钱:");
cunjin=shuru.nextDouble();
cunkuanyue=cunkuanyue+cunjin;
}
public void Qukuan() {
System.out.println("请输入要取出多少钱:");
quchu=shuru.nextDouble();
cunkuanyue=cunkuanyue-quchu;
}
public void Chaxun() {
System.out.println("账号:"+zhanghao+"\n储户姓名:"+chuhuxingming+"\n开户时间:"+year+"-"+month+"-"+day+"\n身份证号码:"+shenfenzhenghaoma+"\n存款余额:"+cunkuanyue);
}
public void finalize() {}
public static void main(String[] args) {
Account yonghu=new Account();
yonghu.set();
Scanner shuru=new Scanner(System.in);
int i=1;
while(i!=0) {
System.out.print("1 存款 2 取款 3 查询 0 退出 ");
i=shuru.nextInt();
switch(i) {
case 1:yonghu.Cunkuan();break;
case 2:yonghu.Qukuan();break;
case 3:yonghu.Chaxun();break;
default:System.out.println("\n谢谢使用");break;
}
}
yonghu.finalize();
}
}
2.实验运行结果
3.实验心得:
此次实验对我来说难度比较大,现在对基本的掌握还不太熟练,都是通过借鉴网上的方法还有同学的方法,无法自己独立完成。编程能力还需要加强,希望老师能多给一些指导。
标签:info mamicode main min image 还需要 util bsp out
原文地址:https://www.cnblogs.com/wzl55/p/10713339.html