上周四我们的第一节java课,王老师给我们进行啦开学考试,这也是上学期放假之前给我们约定好的
但是情况显然没有我想的那么好,其实我觉得这个atm系统比上届学生信息管理系统难的多,上届的话
毕竟有小学期的学生信息管理系统的基础,而这个需要用到数据库还有各种文件操作。反正我拿到题之后
是一脸懵的。老师说程序开头变量的定义是送分的,也的确定义变量函数,写各个函数的get和set函数
确实的挺基础的,写完这个之后我反正是开始了漫长的自学懵逼过程。差不多一个小时吧都是在看书看资料
学习一些基本的东西。学到啦非常非常多的东西。
我觉得老师安排开学的这个 java考试有两个目的,一个是给我们一个下马威,让我们自己知道自己有
几斤几两了。还有就是让我们知道自学的重要性,要知道学习尤其是自学的重要性。包括给我们的暑假作业
也是如此,老师这样做可见还是非常好的,也肯定的费心啦。我c++学的不是很好,我这学期一定要好好学
习java。
另外我觉得我现在的编程存在以下问题:
1. 写的太少,王老师也说过一个一万小时定律,平时懒杂事多,玩的时间太多,导致编程的时间太少,以后
一定 要尽量保证每天的敲代码时间。多写才能知道问题在哪里,才能进一步解决。
2. 基础差,假期没有好好的学习java的基础知识导致现在对java的基础知识掌握不够好,要抽时间补上
3. 态度方面,大二不能再像大一一样贪玩啦,要以学习为主啦。
知道问题所在就要注意改正啦,既然选择啦软件工程 这个专业就要花更多的时间在学习上,这是无可厚非
的,加油吧!!

import java.io.*;//信1705-1 20173644 张子轩
public class ATM {
public static void main(String[] args) throws Exception {

Login l=new Login();
l.login();

}
}

class Account{
private String accountID;
private String accountname;
private String operatedate;
private void operatedate;
private String accountpassword;
private void accountbalance;
private void amount;
public void set_accountID;(String id){
accountID=id;
}
public String get_accountID(){
return accountID;
}
void set_accountname(String name){
accountname=name;
}
String get_accountname(){
return accountname;
}
void set_operatedate(String date){
operatedate=date;
}
String get_operatedate(){
return operatedate;
}
void set_operatetype(void type){
operatedate=type;
}
void get_operatetype(){
return operatetype;
}
void set_accountpassword(String word){
accountpassword=word;
}
String get_accountpassword(){
return accountpassword;
}
void set_accountbalance(void balance){
accountbalance=balance;
}
void get_accountbalance(){
return accountbalance;
}
void set_amount(void amo){
amount=amo;
}
void get_amount(){
return amount;
}
}
class AccountManager
{
void showface(){
System.out.println("*****************************");
System.out.println("欢迎使用中国工商银行自动柜员系统");
System.out.println("*****************************");
System.out.println("请输入您的账号:");
System.out.println(" ")
System.out.println("*****************************");

}
void mainface(){
System.out.println("*****************************");
System.out.println("欢迎使用中国工商银行自动柜员系统");
System.out.println("*****************************");
System.out.println("1.存款:");
System.out.println("2.取款 :");
System.out.println("3.转账汇款:")
System.out.println("4.修改密码:")
System.out.println("5.查询余额:")
System.out.println("*****************************");
}
void mimaface(){
System.out.println("*****************************");
System.out.println("欢迎使用中国工商银行自动柜员系统");
System.out.println("*****************************");
System.out.println("请输入您的密码:");
System.out.println(" ")
System.out.println("*****************************");

}
class Login{
User users=new User("001","123456");//用户名,密码
//登录
void login() throws MyException, IOException{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
DataOutputStream out=new DataOutputStream(new BufferedOutputStream(new FileOutputStream("Account.txt",true)));
for(int i=1;i<=3;i++){
System.out.println("请输入用户ID:");
String id=in.readLine();
System.out.println("请输入密码:");
String pass=in.readLine();
if((users.uername.equals(id))&&(users.passage.equals(pass))){
AccountManager am=new AccountManager();
while(true){
am.mainface();
}

//查询余额
public void account() throws Exception{
System.out.println(balance);
homepage();
}

//取款
public void draw() throws Exception{

int money=0;
if(sum1==5000){
System.out.println("\n"+"对不起,您今日取款已达到限制,请选择其他项目或去柜台取钱。");
TimerTask task = new TimerTask(){
public void run(){
sum1 = 0;
}
};
Timer timer = new Timer();
long delay = 1000*60*60*24;
long period = 1000*60*60*24;
timer.scheduleAtFixedRate(task, delay, period);
homepage();
}
System.out.println("该ATM机一次能取款的最大金额为2000元,2)用户的帐户一天取款累计的最大金额为20000.");
System.out.println("-----------------------------请选择取款金额-------------------------------");
System.out.println(" 1. 500 2. 1000 3. 2000 4. 其他金额");
System.out.println("请选取金额");
int dr=sc.nextInt();
switch(dr){
case 1:
money=500;
//balance-=money;

break;
case 2:
money=1000;
//balance-=money;

break;
case 3:
money=2000;
//balance-=money;

break;
case 4:
System.out.println("只能输入100的整数倍,并且要小于20000.");
System.out.println("请输入金额");
money=sc.nextInt();
if (money % 100 != 0 || money > 20000) {
System.out.println("您输入的金额不是100的整数倍或者大于20000,请选择:");
other(money);
}
break;
default:draw();
}
sum1=sum1+money;
if(money > balance) {
System.out.println("余额不足请重新输入");
draw();
} else if (sum1 > 20000) {
System.out.println("对不起,本次取钱后当天累计金额将超过20000,将跳转到取款界面,请重新取款:" + "\n");
draw();
} else {
balance-=money;

System.out.println("取款成功你的账户余额为" +balance);
// System.out.println(sum);
afterDraw();
}
}

// 一次取款大于2000的操作
public void other(int money) throws Exception {
int num;
System.out.println("1 重新输入取款金额;2 选择退出系统.");
Scanner scanner = new Scanner(System.in);
num = scanner.nextInt();
switch (num) {
case 1:
System.out.println("您选择重新输入金额,将返回取款界面...");
draw();
break;
case 2:
exit();
break;
default:
other(money);
}
}
//取款成功后
public void afterDraw() throws Exception{
int numb;
System.out.println("您选择:1 继续取款;2 返回主页3 退出");
Scanner scanner = new Scanner(System.in);
numb = scanner.nextInt();
switch (numb) {
case 1:
System.out.println("您选择继续取款,将返回取款界面...");
draw();
break;
case 2:
System.out.println("您选择返回主页面,即将返回...");
homepage();
case 3:
System.out.println("您选择退出,即将退出...");
exit();
break;
default:
afterDraw();
}
}

public void exit(){
System.out.println("--------------欢迎再次使用ATM系统,再见!------------");
System.exit(0);
}

class User{
String uername;
String passage;
User(String user,String pass){
this.uername=user;
this.passage=pass;
}
void set_uername(String use){
uername=use;
}
String get_uername(){
return uername;
}
void set_passage(String pass){
passage=pass;
}
String get_passage(){
return passage;
}
}
class MyException extends Exception{
public MyException(String e) {
super(e);
}
}

java开学考试感想及代码的更多相关文章

  1. java开学考试有感以及源码

    一.感想 Java开学测试有感 九月二十号,王老师给我们上的第一节java课,测试. 说实话,不能说是十分有自信,但还好,直到看见了开学测试的题目,之前因为已经做过了王老师发的16级的题目,所以当时还 ...

  2. Java开学测试感想

    开学第一堂课就是测试,测试暑假的自学成果,老师说试卷适当提高了难度,所以允许查书和使用网络查询,经过近三个钟头的努力奋斗和痛苦挣扎,我只完成了一小部分的代码,只有简单的set()get()函数,以及简 ...

  3. java开学第一周测试代码

    Account.java /* 信1705-3 20173612  陈阳阳 */package ATM; public class Account { private String accountID ...

  4. JAVA 开学测试

    package StudentScore; public class ScoreInformation { String stunumber; //学号 String name; //姓名 doubl ...

  5. 第一次JAVA基础考试后的反思

    今天进行了第一次JAVA基础考试,考查了课本上前面三章和方法的知识,基本没有涉及到数组.通过这次的考试,暴露了自己在学习中的很多问题. 机试题是编写一个学员状态转换器,主要运用的是选择语句和方法,而没 ...

  6. JAVA课程学习感想

    JAVA课程学习感想 在学习JAVA之前,我们学习了C语言,汇编语言,数据结构等等.虽然学习了这些,但对于JAVA来说,学习起来不是那么容易,所有的计算机语言有相似的地方,但他们更有不同的地方.对我来 ...

  7. paip.java 注解的详细使用代码

    paip.java 注解的详细使用代码 作者Attilax 艾龙,  EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net/att ...

  8. 在Java中直接调用js代码(转载)

    http://blog.csdn.net/xzyxuanyuan/article/details/8062887 JDK1.6版添加了新的ScriptEngine类,允许用户直接执行js代码. 在Ja ...

  9. 在Java中直接调用js代码

    JDK1.6版添加了新的ScriptEngine类,允许用户直接执行js代码. 在Java中直接调用js代码 不能调用浏览器中定义的js函数,会抛出异常提示ReferenceError: “alert ...

随机推荐

  1. Content-Disposition 响应头,设置文件在浏览器打开还是下载

    Content-Disposition属性有两种类型:inline 和 attachment inline :将文件内容直接显示在页面 attachment:弹出对话框让用户下载 code: cont ...

  2. 初探Angular_02 感受添加组件

    首先把目光聚焦在app这个文件夹里面 1.app.module.ts 这个文件是angular根模块,告诉Angular如何组装应用 // 浏览器解析的模块 import { BrowserModul ...

  3. C#多线程编程系列(三)- 线程同步

    目录 1.1 简介 1.2 执行基本原子操作 1.3 使用Mutex类 1.4 使用SemaphoreSlim类 1.5 使用AutoResetEvent类 1.6 使用ManualResetEven ...

  4. Day 21 序列化模块_Json,Pickle,Shelve

    序列化 , 数据类型,列表 元组, 字符串 只有字符串能被写入文件中. 能在网络上传输的只能是bytes - 字符串 把要传输的和要存储的内容转换成字符串. 字符串 转换回 要传输和存储的内容 序列化 ...

  5. Flask从入门到精通之大型程序的结构二

    一.程序包 程序包用来保存程序的所有代码.模板和静态文件.我们可以把这个包直接称为app(应用),如果有需求,也可使用一个程序专用名字.templates 和static 文件夹是程序包的一部分,因此 ...

  6. GitHub项目加入Travis-CI的自动集成

    Travis-CI是为github量身打造的自动集成环境,如果我们的项目托管在github上,可以十分方便的使用Travis-CI做自动集成. 使用Travis-CI十分的简单,首先打开Travis- ...

  7. MySQL远程登陆解决

    第一句:以权限用户root登录 第二句:选择mysql库 第三句:查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称) 第四句:修改host值(以通配符%的内容增加主机/IP ...

  8. CSS3盒子模型(下)

    绝对定位的盒子水平/垂直居中 普通的盒子是左右margin 改为 auto就可, 但是对于绝对定位就无效了 定位的盒子也可以水平或者垂直居中,有一个算法. 首先left 50% 父盒子的一半大小 然后 ...

  9. 用Python玩转数据第六周——高级数据处理与可视化

    1.matplotlib中有两个模块,pyplot和pylab import matplotlib.pyplot as plt  ///plt.plot(x,y) import pylab as pl ...

  10. 剑指offer三十九之平衡二叉树

    一.题目 输入一棵二叉树,判断该二叉树是否是平衡二叉树. 二.思路 详解代码. 三.代码 public class Solution {     //判断根节点左右子树的深度,高度差超过1,则不平衡 ...