简易银行系统
来源:互联网 发布:淘宝手机大卖场 编辑:程序博客网 时间:2024/06/09 16:25
import java.io.*;
public class BankAccount
{
protected String Name;
protected int Account;
public BankAccount( String UserName, int UserAccount)
{
SetName(UserName);
SetAccount(UserAccount);
}
public void SetName ( String UserName)
{
Name=UserName;
}
public void SetAccount( int UserAccount )
{
Account=UserAccount;
}
protected void Action() throws IOException
{
}
}
import java.io.*;
import java.util.*;
public class Deposit extends BankAccount
{
private int DepositNumber;
File file;
public Deposit(String UserName,int UserAccount,int UserNumber)
{
super(UserName,UserAccount);
DepositNumber=UserNumber;
}
protected void Action() throws IOException
{
file = new File(Name);
if (file.exists())
{
BufferedReader input=new BufferedReader(new FileReader(Name));
String line;
while ((line = input.readLine()) !=null)
{
StringTokenizer tokens = new StringTokenizer(line);
SetAccount(Integer.parseInt(tokens.nextToken()));
}
input.close();
PrintWriter output = new PrintWriter(new FileWriter(file));
output.print(Account+DepositNumber);
output.close();
}
else
{
PrintWriter output = new PrintWriter(new FileWriter(file));
output.print(DepositNumber);
output.close();
}
}
}
import java.io.*;
import javax.swing.JOptionPane;
import java.util.*;
public class WithDraw extends BankAccount
{
private int WithDrawNumber;
public WithDraw (String UserName,int UserAccount,int UserNumber)
{
super(UserName,UserAccount);
WithDrawNumber=UserNumber;
}
protected void Action() throws IOException
{
BufferedReader input=new BufferedReader(new FileReader(Name));
String line;
while ((line = input.readLine()) !=null)
{
StringTokenizer tokens = new StringTokenizer(line);
SetAccount(Integer.parseInt(tokens.nextToken()));
}
input.close();
if (WithDrawNumber>Account)
JOptionPane.showMessageDialog(null, "Not enough money!");
else
{
PrintWriter output = new PrintWriter(new FileWriter(Name));
output.print(Account-WithDrawNumber);
output.close();
}
}
}
- 简易银行系统
- 练习,简易银行系统
- 简易银行取款系统-2
- 简易银行存取款系统-建立数据库
- 简易银行管理系统(XML)
- 简易银行处理系统(源码)
- 用java和oracle做的简易银行系统
- 华为OJ训练之 简易的银行排号叫号系统
- C++: 实现一个简易的银行排号叫号系统
- 提高第40课时,实践,简易银行系统开发
- 华为机试题:实现一个简易的银行叫号系统
- 辣鸡数据结构作业:简易银行管理系统
- 银行系统
- 银行系统
- 银行系统
- 银行系统
- 银行系统
- 银行系统
- Qt4学习-SPREADSHEET之FindDialog
- Windows Media Player & Real Player ActiveX 属性及方法
- Log4J
- 注册成功
- 端口描述
- 简易银行系统
- 在我24岁的时候
- 国内操作系统项目列表(转)--向在国内操作系统领域默默奉献的同人致敬!!
- Error: cannot restore segment prot after reloc: Permission denied
- ns2绑定变量
- 135 137 139 445
- 如何在aodv协议中访问node的各项属性
- 30岁前不必在乎的28件事
- IBM公司的面试题,特发出来,兄弟姐妹们一起讨论答案