开学测试之——ATM
---恢复内容开始---
ATM;
//信1705-2 20173568 李泽宇
import
java.util.*;
import
java.io.File;
import
java.io.FileInputStream;
import
java.io.FileOutputStream;
import
java.io.IOException;
public
class
Account {
public
static
List<Account> accountlist=
new
LinkedList<Account>();
private String accountname;
private String operatedate;
private int operatetype;
private String accountpassword;
private int accountbalance;
private int amount;
public
Account() {};
public
Account(String accountID,String accountname,String operatedate,
int
operatetype,String accountpassword,
int
accountbalance) {
this
.accountID=accountID;
this
.accountname=accountname;
this
.operatedate=operatedate;
this
.operatetype=operatetype;
this
.accountpassword=accountpassword;
this
.accountbalance=accountbalance;
}
public
Account(String accountID,String accountname,String accountpassword,
int
accountbalance) {
this
.accountID=accountID;
this
.accountname=accountname;
this
.accountpassword=accountpassword;
this
.accountbalance=accountbalance;
}
public
Account(String accountID,String accountname,String operatedate,
int
operatetype,
int
amount) {
this
.accountID=accountID;
this
.accountname=accountname;
this
.operatedate=operatedate;
this
.operatetype=operatetype;
this
.amount=amount;
}
public
String get_accountID() {
return
accountID;
}
public
String get_accountname() {
return
accountname;
}
public
String get_operatedate() {
return
operatedate;
}
public
int
get_operatetype() {
return
operatetype;
}
public
String get_accountpassword() {
return
accountpassword;
}
public
int
get_accountbalance() {
return
accountbalance;
}
public
int
get_amount() {
return
amount;
}
public
void
set_accountID(String accountID) {
this
.accountID=accountID;
}
public
void
set_accountname(String accountname) {
this
.accountname=accountname;
}
public
void
set_operatedate(String operatedate) {
this
.operatedate=operatedate;
}
public
void
set_operatetype(
int
type) {
this
.operatetype=type;
}
public
void
set_accountpassword(String password) {
this
.accountpassword=password;
}
public
void
set_accountbalance(
int
balance) {
this
.accountbalance=balance;
}
public
void
set_amount(
int
amount) {
this
.amount=amount;
}
public
static
void
addaccount (String accountID,String accountname,String accountpassword,
int
accountbalance) {
accountlist.add(
new
Account(accountID,accountname,accountpassword,accountbalance));
}
public
static
void
file_in() {
File file0 =
new
File(
"F:/eclipse/ATM"
,
"accountinformation.txt"
);
addaccount(
"20173450"
,
"zhangqiang"
,
"000001"
,
900
);
//创建第一个账户并放入list中
addaccount(
"20173451"
,
"zhanghao"
,
"000002"
,
1000
);
//创建第二个账户
addaccount(
"20173452"
,
"sunyang"
,
"000003"
,
700
);
//创建第三个账户
addaccount(
"20173453"
,
"lihao"
,
"000004"
,
1200
);
//创建第四个账户
addaccount(
"20173454"
,
"liulei"
,
"000005"
,
8500
);
//创建第五个账户//创建文件对象
try
{
if
(!file0.exists()) {
//如果文件不存在则新建文件
file0.createNewFile();
}
FileOutputStream output =
new
FileOutputStream(file0);
for
(
int
j=
0
;j<accountlist.size();j++) {
byte
[] bytes0 =accountlist.get(j).accountID.getBytes();
byte
[] bytes1 =accountlist.get(j).accountname.getBytes();
byte
[] bytes2 =accountlist.get(j).accountpassword.getBytes();
output.write(bytes0);
output.write(bytes1);
output.write(bytes2);
output.write(accountlist.get(j).accountbalance);
}
output.close();
}
catch
(IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
---恢复内容结束---
开学测试之——ATM的更多相关文章
- ATM开学测试(未完成)
package ATM_design; //信1705-2 20173456 张浩 import java.util.*; import java.io.File; import java.io.Fi ...
- JAVA实现ATM源代码及感想
源代码 //20173626 信1705-2 郑锦package ATM;import java.io.IOException;import java.io.File;import java.io.F ...
- java开学考试有感以及源码
一.感想 Java开学测试有感 九月二十号,王老师给我们上的第一节java课,测试. 说实话,不能说是十分有自信,但还好,直到看见了开学测试的题目,之前因为已经做过了王老师发的16级的题目,所以当时还 ...
- java测试ATM自助操作系统
开学第一周系主任安排了一项测试,测试要求:模拟ATM自助取款机用文件进行存储账户信息,密码等,并进行存款取款,转账,查询记录等操作,而且要进行文件的读取与录入. 这是一个ATM自助取款的操作系统,进行 ...
- java开学考试感想及代码
上周四我们的第一节java课,王老师给我们进行啦开学考试,这也是上学期放假之前给我们约定好的 但是情况显然没有我想的那么好,其实我觉得这个atm系统比上届学生信息管理系统难的多,上届的话毕竟有小学期的 ...
- JAVA Atm测试实验心得
通过一个假期的自学,完成了老师布置的样卷任务.使用Escipse编写一个学生成绩的管理系统. 一开始两眼摸黑,通过观看Java课程的视频,地址:https://www.bilibili.com/vid ...
- Java开学测试感想
开学第一堂课就是测试,测试暑假的自学成果,老师说试卷适当提高了难度,所以允许查书和使用网络查询,经过近三个钟头的努力奋斗和痛苦挣扎,我只完成了一小部分的代码,只有简单的set()get()函数,以及简 ...
- 设计模式(十二):通过ATM取款机来认识“状态模式”(State Pattern)
说到状态模式,如果你看过之前发布的重构系列的文章中的<代码重构(六):代码重构完整案例>这篇博客的话,那么你应该对“状态模式”并不陌生,因为我们之前使用到了状态模式进行重构.上一篇博客我们 ...
- 《Google软件测试之道》基础
<Google软件测试之道>,一直听朋友讲起这本书,出于琐事太多,一直没机会拜读,最近部门架构觉得我们IT部门的技术太low,就给我们挑选了一些书籍,让我们多看看... 个人的一种学习习惯 ...
随机推荐
- 通过yum安装最新服务
给yum添加所安装服务最新rpm源 #这里用mysql为例 # wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm # y ...
- 11GR2 双节点RAC 配置单节点DG
只记录主要步骤,供大家参考: RAC 搭建单节点 DG 1 修改源数据库开启归档和force loggingalter system set shared_servers=0; alter datab ...
- DOS下启动MySQL时输入net start mysql 提示服务名无效的问题
原因:mysql服务名错误. 正确做法:net start +mysql服务名
- leetcode第一刷_Plus One
这种相似大整数的处理的问题还是比較常见的,这道题应该是很easy的版本号. 题目的要求是这种,输入的vector靠前的位置是数字的高位.因此应该先求出长度.然后从后面往前算.维护一个变量保存进位.这我 ...
- 【牛客挑战赛30D】小A的昆特牌(组合问题抽象到二维平面)
点此看题面 大致题意: 有\(S\)张无编号的牌,可以将任意张牌锻造成\(n\)种步兵或\(m\)种弩兵中的一种,求最后步兵数量大于等于\(l\)小于等于\(r\)的方案数. 暴力式子 首先我们来考虑 ...
- HDU 6103
题意: 求最长的两个不相交的子序列,dis <= m : 分析: 当时二分了答案,暴力匹配,TLE了,然后考虑了,O(n^2)预处理出所有区间 dis,然后答案是所有dis中>=m的最长长 ...
- Uva 11600 期望DP
题意:n个城市,相互可达(有n(n-1)/2条边),其中有一些道路上面有妖怪,现在,从1号城市出发,随机挑取一个城市走去,这个道路上的妖怪就会被消灭,求: 在平均情况下,需要走多少步,使得任意两个城市 ...
- 应用性能指数(APDEX)是如何计算出来的?
应用性能指数(APDEX)是如何计算出来的?在应用性能管理领域聚合指标是一种常见手段,主要是用来把成百上千的指标通过某种计算方法聚合成一个或几个指标,用来反映应用的整体健康状态.在这些聚合指标中,比较 ...
- Css 截取字符串长度
.shortNameShow{ overflow:hidden; text-overflow:ellipsis; -o-text-overflow:ellipsis; white-space:nowr ...
- 【luogu P3373 线段树2】 模板
题目链接:https://www.luogu.org/problemnew/show/P3373 lazy标记两个,先乘后加 #include <iostream> #include &l ...