软件工程-银行储蓄管理系统源代码
软件工程银行储蓄管理系统设计[2]
软件实现报告1.设计目的该阶段是系统开发过程的最后一个阶段,按照前三个阶段的设计,在这个阶段要选择适当的计算机语言来编写程序以及实现该软件的各项功能,并且对软件设计测试方法。
2.软件源代码如下:(1)银行储蓄系统Private Sub cunkuan0_Click()Unload Mecunkuan.ShowEnd SubPrivate Sub denglu1_Click()Unload Medenglu.ShowEnd SubPrivate Sub Form_Load()If flag = 0 Thendenglu1.Enabled = Truezhukong.Enabled = Falsetuichu.Enabled = FalseElseIf flag = 1 Thendenglu1.Enabled = Falsezhukong.Enabled = Truetuichu.Enabled = TrueElseIf flag = 2 Thendenglu1.Enabled = Falsezhukong.Enabled = Falsetuichu.Enabled = FalseElseEndEnd IfEnd IfEnd IfEnd SubPrivate Sub kaihu0_Click()Unload Mekaihu.ShowEnd SubPrivate Sub qukuan0_Click()Unload Mequkuan.ShowEnd SubPrivate Sub tuichu_Click()flag = 0Unload Mekaishi.ShowEnd SubPrivate Sub xiaohu0_Click()Unload Mexiaohu.ShowEnd SubPrivate Sub xingaimima0_Click()Unload Mexiugaimima.ShowEnd SubPrivate Sub zhaxun0_Click()Unload Mechaxun.ShowEnd SubPrivate Sub zhuanzhang0_Click()Unload Mezhuanzhang.ShowEnd Sub(2)查询Private Sub Command1_Click()Set con = New ADODB.Connectioncon.Open connectstringSet rst = New ADODB.Recordsetrst.Open "select * from zhanghaoxinxi where zhanghao='" & Text1.Text & "'", con, adOpenKeyset, adLockOptimisticIf rst.BOF And rst.EOF ThenMsgBox "此用户不存在!"ElseIf Text2.Text = rst!mima Thenchaxunyue.Text1.Text = Text1.TextUnload Mechaxunyue.ShowEnd IfEnd Ifrst.Closecon.CloseEnd SubPrivate Sub Command2_Click()flag = 1Unload Mekaishi.ShowEnd Sub(3)查询余额Private Sub Command1_Click()cunqukuanrili.Text1.Text = Text1.TextUnload Mecunqukuanrili.ShowEnd SubPrivate Sub Command2_Click()yonghuxinxi.Text1.Text = Text1.TextUnload Meyonghuxinxi.ShowEnd SubPrivate Sub Command3_Click()flag = 1Unload Mekaishi.ShowEnd Sub(4)登录Private Sub Command1_Click()Set con = New ADODB.Connectioncon.Open connectstringSet rst = New ADODB.Recordsetrst.Open "select * from yonghuxixin", con, adOpenKeyset, adLockOptimistic If rst.BOF And rst.EOF ThenIf Text1(0).Text = "gyn" And Text2(1).Text = "000" Thenflag = 1Unload Mekaishi.ShowElseMsgBox "输入不正确!"End IfElseDo While Not rst.EOFIf rst!yonghudaihao = Text1(0).Text ThenIf rst!mima = Text2(1).Text Thenflag = 1Unload Mekaishi.ShowEnd IfEnd Ifrst.MoveNextLooprst.Closecon.CloseIf flag = 0 ThenMsgBox " 此用户不存在!"End IfEnd IfEnd SubPrivate Sub Command2_Click()flag = 0Unload Mekaishi.ShowEnd Sub(5)开户Private Sub Command1_Click()If Text1.Text = "" ThenMsgBox "姓名不能为空"Text1.SetFocusEnd IfIf Text4.Text = "" ThenMsgBox "身份证号码不能为空"Text4.SetFocusEnd IfSet con = New ADODB.Connectioncon.Open connectstringSet rst = New ADODB.Recordsetrst.Open "select * from yonghuxinxi1", con, adOpenKeyset, adLockOptimistic rst.AddNewrst!shenfengzheng = Text4.Textrst!xingming = Text1.Textrst!xingbie = Text5.Textrst!zhuzhi = Text2.Textrst!dianhua = Text3.Textrst.Updatekaihu1.Text2.Text = Text1.Textkaihu1.Text8.Text = Text5.Textkaihu1.Text3.Text = Text4.Textkaihu1.Text4.Text = Text2.Textkaihu1.Text5.Text = Text3.Textrst.Closecon.CloseUnload Mekaihu1.ShowEnd SubPrivate Sub Command2_Click()flag = 1kaishi.ShowEnd Sub(6)销户Private Sub Command1_Click()yonghuxinxi.Text1.Text = Text1.TextUnload Meyonghuxinxi.ShowEnd SubPrivate Sub Command2_Click()Set con = New ADODB.Connectioncon.Open connectstringSet rst = New ADODB.Recordsetrst.Open "select * from zhanghaoxinxi", con, adOpenKeyset, adLockOptimistic If rst.BOF And rst.EOF ThenMsgBox "无记录,请先插入记录!"ElseDo While Not rst.EOFIf rst!zhanghao = Text1.Text ThenIf rst!mima = Text2.Text Thenrst.Deleterst.UpdateElseMsgBox "密码不正确!"End IfEnd Ifrst.MoveNextLoopIf rst.EOF ThenMsgBox "此用户不存在!"End Ifrst.Closecon.CloseEnd Ifrst.Closecon.CloseEnd SubPrivate Sub Command3_Click()flag = 1Unload Mekaishi.Show(7)修改密码Private Sub Command1_Click()Set con = New ADODB.Connectioncon.Open connectstringSet rst = New ADODB.Recordsetrst.Open "select * from zhanghaoxinxi where zhanghao='" & Text1.Text & "'", con, adOpenKeyset, adLockOptimisticIf rst.BOF And rst.EOF ThenMsgBox "此用户不存在!"ElseIf Text2.Text = rst!mima Thenxiugaimima1.Text1.Text = Text1.Textxiugaimima1.Text4.Text = Text2.TextUnload Mexiugaimima1.ShowEnd IfEnd Ifrst.Closecon.CloseEnd Sub(8)修改密码1Private Sub Command1_Click()If Text2.Text <> Text3.Text ThenMsgBox "密码不一致!"ElseSet con = New ADODB.Connectioncon.Open connectstringSet rst = New ADODB.Recordsetrst.Open "select * from yonghuxixin where yonghudaihao= '" & Text1.Text & "'", con, adOpenKeyset, adLockOptimisticrst!mima = Text3.Textrst.Updaterst.CloseSet rst = New ADODB.Recordsetrst.Open "select * from zhanghaoxinxi where zhanghao= '" & Text1.Text & "'", con, adOpenKeyset, adLockOptimisticrst!mima = Text3.Textrst.UpdateMsgBox "修改成功!"rst.Closecon.CloseEnd IfSet con = New ADODB.Connectioncon.Open connectstringSet rst = New ADODB.Recordsetrst.Open "select * from cunkuanrili", con, adOpenKeyset, adLockOptimisticrst.AddNewrst!zhanghao = Text1.TextDim nowtime As Stringnowtime = Nowrst!caozuoriqi = Format(nowtime, "yyyy") + "-" + Format(nowtime, "mm") + "-" + Format(nowtime, "dd") + "-" + Format(nowtime, "hh") + ":" + Format(nowtime, "nn") + ":" + Format(nowtime, "ss")rst!caozuo = "修改密码"rst.Updaterst.Closecon.CloseEnd SubPrivate Sub Command3_Click()flag = 1Unload Mekaishi.ShowEnd Sub(9)转账Private Sub Command1_Click()Set con = New ADODB.Connectioncon.Open connectstringSet rst = New ADODB.Recordsetrst.Open "select * from zhanghaoxinxi where zhanghao='" & Text3.Text & "'", con, adOpenKeyset, adLockOptimisticIf rst.BOF And rst.EOF ThenMsgBox "此用户不存在!"ElseIf Text4.Text = rst!mima Thenrst!zhanghuyue = CInt(rst!zhanghuyue) - CInt(Text2.Text)rst.Updaterst.CloseSet rst = New ADODB.Recordsetrst.Open "select * from zhanghaoxinxi where zhanghao='" & Text1.Text & "'", con, adOpenKeyset, adLockOptimisticIf CInt(Text2.Text) > rst!zhanghuyue ThenMsgBox "余额不足!"Elserst!zhanghuyue = CInt(rst!zhanghuyue) + CInt(Text2.Text)rst.Updaterst.Closecon.CloseEnd IfEnd IfEnd IfEnd SubPrivate Sub Command3_Click() flag = 1Unload Mekaishi.ShowEnd Sub3.部分界面如下:。
C语言银行储蓄系统源码
}
printf("\n");
r=strcmp(banks[accountnum].password,password1);
if(r!=0)
{
printf("两次密码不相同,开户失败!\n");
return;
}
banks[accountnum].balance=0;
banks[accountnum].state=0;
if(money==0)
{
printf("转账失败\n");
return;
}
else
{
if(money>banks[nowaccount].balance)
printf("您的账户没有这么多余额,转账失败!\n");
else
{
banks[nowaccount].balance-=money;
banks[a].balance+=money;
C语言银行储蓄系统源码
这篇文章主要为大家详细介绍了C语言银行储蓄系统源码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
void openaccount();//开户
{
r1=strcmp(account1,banks[j].account);
r2=strcmp(password1,banks[j].password);
银行管理系统源代码文档
#include<iostream>#include<fstream>#include<string>using namespace std;class user; //声明用户类class yinhang{ //银行类public:void set_account();//开户函数void del_account();//销户函数void transfer_accounts(int a);//转账函数void enter();//登录函数void menu();//菜单函数void exit_yinhang();//退出函数void save();void load();protected:static int amount;//静态成员,用于统计银行账户数user *account[100];//账户数};int yinhang::amount=0;//静态成员赋值,初始为0class user:public yinhang{ //用户类private:string id;//账号string mm;//密码string name;//姓名double balance;//余额string identity_card;//身份证string unit;//单位string phone;//电话号码string address;//地址public:user()//不带参数的构造函数{id='0';mm='0';name='0';balance=0;identity_card='0';unit='0';phone='0';address='0';}user(string id1,string mm1,string name1,double balance1,string identity_card1,string unit1,string phone1,string address1) //带参数的构造函数id=id1;mm=mm1;name=name1;balance=balance1;identity_card=identity_card1;unit=unit1;phone=phone1;address=address1;}friend class yinhang;//声明yinhang类是user的友元类void save_money();//存钱函数void fetch_money();//取钱函数void show()//显示函数{system("cls");cout<<endl;cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<<endl<<endl<<en dl;cout<<" 姓名:"<<name<<endl;cout<<" 账号:"<<id<<endl;cout<<" 余额:"<<balance<<endl;cout<<" 身份证:"<<identity_card<<endl;cout<<" 单位:"<<unit<<endl;cout<<" 电话号码:"<<phone<<endl;cout<<" 地址:"<<address<<endl<<endl<<endl;cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<<endl;}string get_id()//取得账号{return id;}string get_mm()// 取得密码{return mm;}int get_balance()//取得余额{return balance;}void add_money(double x)//通过公有成员函数访问私有成员{balance=x+balance;void dec_money(double x){balance=balance-x;}};void yinhang::save(){ofstream o("g:\\C++\\祁鹏涛\\银行账户信息.txt",ios::out);int n=0;for(n=0;n<amount;n++){o<<account[n]->id<<endl;//写入账号o<<account[n]->mm<<endl;o<<account[n]->name<<endl;o<<account[n]->balance<<endl;o<<account[n]->identity_card<<endl;o<<account[n]->unit<<endl;o<<account[n]->phone<<endl;o<<account[n]->address<<endl;}o.close();}void yinhang::load(){ifstream i("g:\\c++\\祁鹏涛\\银行账户信息.txt",ios::in);int n;for(n=0;n<amount;n++){i>>account[n]->id;//读取账号i>>account[n]->mm;i>>account[n]->name;i>>account[n]->balance;i>>account[n]->identity_card;i>>account[n]->unit;i>>account[n]->phone;i>>account[n]->address;}i.close();}void yinhang::set_account() //开户函数的定义{string id1;string mm1;string name1;double balance1;string identity_card1;string unit1;string phone1;string address1;cout<<"请输入开户人账号:";cin>>id1;int m=0;for(int i=0;i<amount;i++){if(id1==account[i]->get_id()){m=1;}}if(m){cout<<"本账号已经存在!"<<endl;return;}cout<<"请输入密码:";cin>>mm1;cout<<"请输入姓名:";cin>>name1;cout<<"请输入存入金额:";cin>>balance1;while(balance1<0){cout<<"请输入正确的数字!"<<endl;cout<<"请重新输入:";cin>>balance1;}cout<<"请输入开户人身份证:";cin>>identity_card1;cout<<"请输入工作单位:";cin>>unit1;cout<<"请输入电话号码:";cin>>phone1;cout<<"请输入地址:";cin>>address1;cout<<"开户成功!"<<endl;user *u=new user(id1,mm1,name1,balance1,identity_card1,unit1,phone1,address1); account[amount]=u;amount++;save();}void yinhang::del_account() //销户函数的定义{string id1;int i=0;int m=1;cout<<"请输入需要注销的银行卡号:";cin>>id1;while((i<amount)&&(m)) //从0开始进行依次检索,判断id1与其中的一个账号是否相等{if(id1==account[i]->get_id())m=0;elsei++;}if(m){cout<<" 该帐号不存在!"<<endl;return;}for(int j=i;j<amount;j++){account[j]=account[j+1];}account[amount-1]=NULL;amount=amount-1;cout<<"你的银行账户已经注销成功!"<<endl;save();}void yinhang::transfer_accounts(int x) //转账函数的定义{string id1;cout<<"请输入帐号:";cin>>id1;int m=1;int i=0;while((i<amount)&&(m)){if(id1==account[i]->get_id())m=0;elsei++;}if(m){cout<<"帐号不存在!"<<endl;return;}double b;cout<<"请输入你要转帐的金额:";cin>>b;while(b<=0){cout<<"请输入正确的数字!"<<endl;cout<<"请输入:";cin>>b;}if(account[x]->get_balance()<b)cout<<"对不起,金额不够!!"<<endl;else{account[x]->dec_money(b);account[i]->add_money(b);cout<<"转账成功!"<<endl;}return;}void yinhang::enter() //登录函数{string id1;cout<<"请输入银行账号:";cin>>id1;int m=1;int i=0;while((i<amount)&&(m)){if(id1==account[i]->get_id())m=0;elsei++;}if(m){cout<<"帐号不存在!"<<endl;return;cout<<"请输入密码:";string mm1;cin>>mm1;if(mm1!=account[i]->get_mm()) return;do{cout<<"登录成功,请选择下列操作:"<<endl;cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<<endl<<endl<<endl;cout<<" 1.查看账户信息"<<endl<<endl;cout<<" 2.取款"<<endl<<endl;cout<<" 3.存款"<<endl<<endl;cout<<" 4.转账"<<endl<<endl;cout<<" 5.退出本次登录"<<endl<<endl<<endl;cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<<endl;int n;cout<<"请选择:";cin>>n;system("cls");switch(n){case 1: account[i]->show();system("pause");break;case 2: account[i]->fetch_money();save();system("pause");break;case 3:account[i]->save_money();save();system("pause");break;case 4:transfer_accounts(i);save();system("pause");break;case 5:return;}}while(1);}void yinhang::exit_yinhang() //退出系统{cout<<"欢迎下次光临!"<<endl;exit(0);}void user::save_money() //存款函数{double m;cout<<"请输入存款金额:";cin>>m;while(m<=0){cout<<"请输入正确的数字!"<<endl;cin>>m;balance=balance+m;cout<<"存款成功!"<<endl;}void user::fetch_money() //取款函数{double m;cout<<"请输入取款金额:"<<endl ;cin>>m;while(m<=0){cout<<"请输入正确的数字!"<<endl;cin>>m;}if(balance<m)cout<<"对不起,你的余额已不足!"<<endl;else{balance=balance-m;cout<<"取款成功!"<<endl;}}void yinhang::menu(){do{load();cout<<endl;cout<<" 欢迎光临"<<endl;cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<<endl<<endl;cout<<" 1.开户"<<endl;cout<<" 2.登录"<<endl;cout<<" 3.注销"<<endl;cout<<" 4.退出"<<endl<<endl;cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<<endl;int n;cout<<"请选择:";cin>>n;system("cls");switch(n){case 1:set_account();system("pause");//开户break;case 2:enter();system("pause");//登录break;case 3:del_account();system("pause");//注销break;case 4:exit_yinhang();system("pause");//退出break;}}while(1);}void main(){yinhang yh;yh.menu();}。
银行管理系统c语言程序设计代码
银行管理系统c语言程序设计代码以下是一个简单的银行管理系统的C语言程序设计代码示例:```c#include <stdio.h>#include <stdlib.h>struct BankAccount {int accountNumber;char accountHolder[50];float balance;};void createAccount(struct BankAccount *account) {printf("请输入账户号码: ");scanf("%d", &(account->accountNumber));printf("请输入账户持有人姓名: ");scanf("%s", account->accountHolder);printf("请输入账户余额: ");scanf("%f", &(account->balance));printf("账户创建成功!\n");}void deposit(struct BankAccount *account) {float amount;printf("请输入存款金额: ");scanf("%f", &amount);account->balance += amount;printf("存款成功!\n");}void withdraw(struct BankAccount *account) {float amount;printf("请输入取款金额: ");scanf("%f", &amount);if (amount > account->balance) {printf("余额不足,取款失败!\n");} else {account->balance -= amount;printf("取款成功!\n");}}void displayAccount(struct BankAccount *account) {printf("账户号码: %d\n", account->accountNumber);printf("账户持有人姓名: %s\n", account->accountHolder); printf("账户余额: %.2f\n", account->balance);}int main() {struct BankAccount account;int choice;while (1) {printf("\n银行管理系统\n");printf("1. 创建账户\n");printf("2. 存款\n");printf("3. 取款\n");printf("4. 显示账户信息\n");printf("5. 退出\n");printf("请选择操作: ");scanf("%d", &choice);switch (choice) {case 1:createAccount(&account); break;case 2:deposit(&account);break;case 3:withdraw(&account);break;case 4:displayAccount(&account);break;case 5:printf("感谢使用银行管理系统,再见!\n");exit(0);default:printf("无效的选择,请重新输入。
银行储蓄开发程序代码C++
实验项目:银行储蓄实验项目一、银行储蓄系统主菜单模块设计与实现1.1库函数描述(原型、功能、头部文件)及其作用Time显示当前时间类 #include<time.H>System()调用dos命令 _sleep()停息#include<stdlib.H>String 字符串流#include<string.H>#include"myheader.h"中有调用的全部函数声明1.2编码(必须附加注释)#include"myheader.h"void main(){//背景颜色设置system("COLOR 16");/*颜色属性由两个十六进制数字指定 -- 第一个为背景,第二个则为前景。
每个数字可以为以下任何值之一:0 = 黑色 8 = 灰色1 = 蓝色 9 = 淡蓝色2 = 绿色 A = 淡绿色3 = 湖蓝色 B = 淡浅绿色4 = 红色 C = 淡红色5 = 紫色 D = 淡紫色6 = 黄色 E = 淡黄色7 = 白色 F = 亮白色*///输出=============★欢迎进入银行活期存款系统★=============int i;for(i=0;i<13;i++)cout<<'=';cout<<"★欢迎进入银行活期存款系统★";for(i=0;i<13;i++)cout<<'=';cout<<endl;//列示当前时间cout<<"当前时间:";for(i=0;i<6;i++)cout<<" ";Time t=latesttime();t.print();//列示菜单mylist();cout<<"如果您不了解该系统请按N否则按Y: ";//核实输入是否为字符string check;while(1){cin>>check;if(check.length()>1){cout<<"您的输入有误请重新输入:";continue;}if(check[0]!='Y'&&check[0]!='N')cout<<"您的输入有误请重新输入:";elsebreak;}int mark=1;if(check[0]=='N'){mark=0;cout<<"友情提示:按对应业务的编号即可进行该业务!"<<endl<<"请继续:"<<endl;}int flag=1;while(flag++){if(flag>2){system("cls");mylist();}if(mark)cout<<"请选择业务:";string servicenum;//核实输入是否为字符while(1){cin>>servicenum;if(servicenum.length()>1){cout<<"您的输入有误请重新输入:";continue;}elsebreak;}cout<<"确认请按Y,修改请按N,请选择:"; string mark;//核实输入是否为字符while(1){cin>>mark;if(mark.length()>1){cout<<"您的输入有误请重新输入:";continue;}if(mark[0]!='Y'&&mark[0]!='N')cout<<"您的输入有误请重新输入:";elsebreak;}if(mark[0]=='N')continue;if(servicenum[0]=='0')break;cout<<" 正在处理请稍等.";_sleep(1000);cout<<".";_sleep(1000);cout<<".\n";_sleep(1000);switch(servicenum[0]){//开户case '1': creaccount();break;//存款case '2': deposit();break;//取款case '3': withdraw();break;//计息case '4': computeprofit();break;//查询case '5': checkbalance();break;//排序case '6': order();break;//系统介绍case '7': about(); break;default: cout<<"对不起,您的选择超出了我们的业务范围。
软件工程——银行储蓄系统 -
软件工程——银行储蓄系统 -1.引言1.1 目的本文档旨在描述和规范银行储蓄系统的设计和开发过程,确保系统能够满足用户的需求和预期功能。
1.2 背景银行储蓄系统是为银行提供一种机制,使客户能够进行存款、取款和查询等操作的系统。
2.需求分析2.1 功能需求银行储蓄系统应具备以下功能:- 客户登录与注册- 存款与取款- 余额查询与交易记录查询- 转账与收款- 密码重置2.2 非功能需求银行储蓄系统应具备以下非功能需求:- 用户界面友好、易于使用- 系统响应时间快- 数据安全性高- 高并发能力- 可靠性和可扩展性3.概要设计3.1 系统架构银行储蓄系统采用分层架构,包括以下层:- 用户界面层:提供用户登录、存款、取款等功能的界面- 业务逻辑层:处理用户请求,进行业务逻辑处理- 数据访问层:与数据库进行交互,完成数据的读写操作3.2 模块设计银行储蓄系统的主要模块包括:- 用户管理模块:处理用户注册、登录、密码重置等功能- 账户管理模块:负责处理存款、取款和余额查询等功能- 交易记录模块:记录用户的交易历史- 转账模块:处理用户的转账和收款功能4.详细设计4.1 用户管理模块设计4.1.1 用户注册功能设计- 输入用户名、密码、邮箱等信息- 检查用户名是否已存在- 将用户信息存入数据库4.1.2 用户登录功能设计- 输入用户名和密码- 验证用户名和密码- 登录成功后跳转到账户管理界面4.2 账户管理模块设计4.2.1 存款功能设计- 输入存款金额- 更新账户余额- 记录交易历史4.2.2 取款功能设计- 输入取款金额- 检查账户余额是否充足- 更新账户余额- 记录交易历史5.测试计划5.1 单元测试对各个模块进行单元测试,验证其功能和性能是否达到预期。
5.2 验收测试整体测试银行储蓄系统,确保其符合用户需求和预期功能。
6.附件本文档涉及的附件包括界面原型图、数据库设计文档等。
7.法律名词及注释- 存款:客户将资金存入银行账户- 取款:客户从银行账户中取出资金- 余额查询:客户查询账户中的余额情况- 转账:客户将资金从自己的账户转入其他账户- 收款:客户接收他人转账的资金。
龙纯鹏组软件工程-银行储蓄系统源程序
中国矿业大学(北京)软件工程导论实验报告课程名称:软件工程导论实验名称:银行储蓄系统源程序班级:信息与计算科学(1)班组长:龙纯鹏组员:代喜白鑫刘永鸿侯佳意实验日期: 2014年4月2日指导老师姓名:王颖组内任务分配:龙纯鹏11107200110组长、主要负责可行性分析报告和需求分析报告代喜 11107200103 主要负责系统设计白鑫 11107200101 刘永鸿11107200210 主要负责编写代码侯佳意11107200106主要负责用户手册#include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>#define N 10000struct chuhu //储户结构信息{char idnum[11]; //帐号char password[7]; //密码char name[11]; //储户姓名char idnumber[19]; //储户身份证号码double cunkuan; //存款金额double lixi; //利息double yu; //余额int lei; //储种char address[51]; //储户地址char Tel[15]; //储户的联系电话char khdate[40]; //开户日期int g; //是否挂失(0为未,1为已)}hu[N];//储户结构数组void wang(); //显示“※理学院信软专业※”的函数int yanzheng(); //验证帐号和密码并核查该帐号是否挂失的函数void li(); //计算利息的函数void date(); //显示当前日期和时间void insert(); //开户函数void display(); //显示所有帐户信息的函数void in(int); //存款函数void find(int); //查询余额函数void out(int); //取款函数void zhuan(int); //转帐函数void changepwd(int); //修改密码的函数void guashi(int); //挂失函数void del(int); //销户函数void lilvbiao(); //查看利率表void cxgs(); //撤消挂失的函数void grxx(int); //查看个人信息的函数void help(); //储户须知函数void bangzhu(); //帮助int i,j,k,A=0,B=0; //i,j控制循环,id为帐号,A、B分别为开户数和销户数double jin; //存款、取款或转帐金额char ch='y'; //控制是否继续的变量char id[11],password[7];void main() //输出主菜单{int a,b; //选择功能的变量char dlzh[11],pword[7];system("color 79");date();printf("\n\n\n\t\t※※※※※※※※※※※※※※※※※※※※※※※※※\n");printf("\t\t※※\n"); //界面1 printf("\t\t※※\n");printf("\t\t※银行储蓄管理模拟系统※\n");printf("\t\t※理学院信软专业※\n");printf("\t\t※※\n");printf("\t\t※※\n");printf("\t\t※※\n");printf("\t\t※※※※※※※※※※※※※※※※※※※※※※※※※\n\n\n\n");wang();printf("按ENTER键进入下一界面。
软件工程导论 银行储蓄系统
所属数据流:F1、F2、F6、F7
所属存储:D1、D2
类型:位数:取值范围:定义:
字符8位汉子1{字符}8
说明:
2、数据流:
数据流
名称:存款单编号:F1
来源:外部实体“储户”
去向:P1存款处理
数据结构:姓名、地址、电话、身份证号、存款类型、存款日期、到期日期、利率、密码
说明:
3、数据存储:
数据存储
名称:储户信息库编号:D1
相关处理:有P1写入
读取其的数据处理有:P2.1
名称:类型:位数:取值范围:
姓名字符8位汉子
说明:
软件工程导论软件工程导论pdf系统化思维导论pdf系统工程导论系统化思维导论数据库系统导论无人机系统导论地理信息系统导论计算机系统导论雷达系统导论
银行储蓄系统
一、数据流程图:
1、顶层图如下图1所示:
2、一级细化图如下图2所示:
3、二级细化图素:
数据元素
名称:储户姓名编号:
软件工程课程设计银行储蓄管理系统
资源利用率:评估 系统对硬件资源的 占用情况
数据库优化:采用索引、分区等技术提高查询效率 代码优化:精简冗余代码,提高代码复用率 系统架构优化:采用微服务、分布式等技术提高系统可扩展性和可靠性 安全性优化:加强数据加密、权限控制等措施保障系统安全
评估现有系统的性能和功能 分析系统瓶颈和潜在的改进点 确定升级和改进的目标和需求 制定升级和改进的方案和计划
用户登录验证功能 存款、取款功能
账户管理功能 查询余额功能
系统安全性:确保 数据安全,防止未 经授权的访问和篡 改。
系统稳定性:确保 系统在高负载和复 杂环境下能够稳定 运行。
系统可扩展性:为 未来功能扩展和升 级提供足够的空间 和支持。
系统易用性:提供 用户友好的界面和 操作体验,方便用 户快速上手和使用。
软件工程课程设计银行储蓄管理系统的应用具有广泛的实际意义,可以为银行储蓄业 务提供更好的服务,提高客户满意度,增强银行的市场竞争力
背景:软件工程课程设计银行储蓄管理系统是为了满足银行储蓄业务的需求,提高银行业务处理效率和客户满意度。 目的:通过软件工程课程设计,使学生掌握软件设计的基本原理和方法,提高软件开发和维护的能力。 意义:该系统的开发有助于提高学生的实践能力,培养创新思维和团队协作精神,为未来的软件开发工作打下基础。
菜单栏:包含所有功能选项, 方便用户快速访问
用户界面布局:简洁明了, 易于操作
工具栏:提供常用功能快捷 方式,提高操作效率
状态栏:显示系统状态和提示 信息,帮助用户更好地了解系
统运行情况
用户身份验证:采用 用户名和密码进行身 份验证,确保只有授 权用户能够访问系统。
数据加密:对敏感数 据进行加密存储,确 保数据在传输和存储 过程中的安全性。
数据库课程设计银行储蓄系统完全代码
数据库课程设计银行储蓄系统完全代码数据库课程设计完全代码--建库create database Bankon primary(name ='Bank',filename='D:\project\Bank.mdf',size = 5,maxsize = 100,filegrowth = 10%)log on(name ='Bank_log',filename='D:\project\Bank_log.ldf', size=2,filegrowth=1)go--建表use Bankcreate table Depositors(BNo varchar(20)primary key,--账号BName varchar(20)not null,--姓名BPassword char(6)not null check(len(BPassword)= 6),--密码BID varchar(20)not null,--身份证号BSex char(2)not null check(BSex ='男'or BSex ='女'), --性别BStyle varchar(20)not null check(BStyle ='活期存款'or BStyle ='定期存款'),--业务类型BDate datetime not null,--开户时间BYear int not null check(BYear = 0 or BYear = 1 or BYear = 2 or BYear = 3),--存款期限,0表示活期BMoney decimal(10,4)not null check(BMoney >= 0)--账户余额)create table CurrentAccounts(nID int primary key identity(1,1),--流水号BNo varchar(20)not null references Depositors(BNo),--账号BName varchar(20)not null,--姓名BStyle varchar(20)not null check(BStyle ='活期存款'or BStyle ='活期取款'),--操作类型BCash decimal(10,4)null check(BCash >= 0),--操作金额BDate datetime not null,--操作时间BInterest decimal(10,4)null check(BInterest >= 0),--利息BMoney decimal(10,4)not null check(BMoney >= 0),--账户余额)create table FixedAccounts(nID int primary key identity(1,1),--流水号BNo varchar(20)not null references Depositors(BNo),--账号BName varchar(20)not null,--姓名BStyle varchar(20)not null check(BStyle ='定期存款'or BStyle ='定期取款'),--操作类型BMoney decimal(10,4)not null check(BMoney >= 0),--存取金额BYear int not null check(BYear = 1 or BYear = 2 or BYear = 3),--存款期限BDate datetime not null--存款时间插入触发器create trigger InsertIntoCAorFA on Depositorsafter insertasdeclare @year intselect @year = BYear from insertedif @year = 0insert intoCurrentAccounts(BNo,BName,BStyle,BDate,BMoney)select BNo,BName,BStyle,BDate,BMoney from insertedelseinsert intoFixedAccounts(BNo,BName,BStyle,BMoney,BYear,BDate)select BNo,BName,BStyle,BMoney,BYear,BDate from inserted删除触发器create trigger DeleteFromCAorFA on Depositorsinstead of deleteasdeclare @no varchar(20)select @no = BNo from deleteddelete from CurrentAccounts where BNo = @nodelete from FixedAccounts where BNo = @nodelete from Depositors where BNo = @no(1)开户登记&(2)定期存款insert intoDepositors(BNo,BName,BPassword,BID,BSex,BStyle,BDate,BYea r,BMoney)values(10001,'张三',123456,,'男','活期存款',' -01-01',0,10000)insert intoDepositors(BNo,BName,BPassword,BID,BSex,BStyle,BDate,BYea r,BMoney)values(10002,'李四',123456,,'男','活期存款',' -01-02',0, 0)insert intoDepositors(BNo,BName,BPassword,BID,BSex,BStyle,BDate,BYea r,BMoney)values(10003,'王五',123456,,'男','定期存款',' -01-03',2,30000)insert intoDepositors(BNo,BName,BPassword,BID,BSex,BStyle,BDate,BYea r,BMoney)values(10004,'小丽',123456,,'女','定期存款',' -01-04',3,40000)create view ViewOfCurrentAccounts --参考asselect BNo 账号,BName 姓名,BStyle 操作类型,BCash 操作金额,BDate 操作时间,BInterest 利息,BMoney 账户余额from CurrentAccountsselect*from Depositorsselect*from CurrentAccountsselect*from FixedAccounts(3)定期取款create procedure FixedWithdraw@No varchar(20),@Date datetimeasif((select BYear from FixedAccounts where BNo = @No)= 1) beginif((select datediff(day,(select BDate from FixedAccounts where BNo = @No),@Date))> 360)begininsert intoFixedAccounts(BNo,BName,BStyle,BMoney,BYear,BDate) values(@No,(select BName from FixedAccounts where BNo = @No),'定期取款',(select BMoney from FixedAccounts whereBNo = @No)*1.0275,1,@Date) --利息计算select*from FixedAccounts where BNo = @No endelseprint'定期存款未满一年!'endelse if((select BYear from FixedAccounts where BNo =@No)= 2)beginif((select datediff(day,(select BDate from FixedAccounts where BNo = @No),@Date))> 360*2) begininsert intoFixedAccounts(BNo,BName,BStyle,BMoney,BYear,BDate) values(@No,(select BName from FixedAccounts where BNo = @No),'定期取款',(select BMoney from FixedAccounts where BNo = @No)*power(1.035,2),2,@Date)select*from FixedAccounts where BNo = @No endelseprint'定期存款未满两年!'endelsebeginif((select datediff(day,(select BDate from FixedAccounts where BNo = @No),@Date))> 360*3) begininsert intoFixedAccounts(BNo,BName,BStyle,BMoney,BYear,BDate) values(@No,(select BName from FixedAccounts where BNo = @No),'定期取款',(select BMoney from FixedAccounts where BNo = @No)*power(1.04,3),3,@Date)select*from FixedAccounts where BNo = @No endelseprint'定期存款未满三年!'endexec FixedWithdraw10003,' -01-04' --取款(4)&(5)活期存取款create proc CurrentWithdraw@No varchar(20),@Money float,@Date datetimeasdeclare @temp decimal(10,4)select @temp =(((select datediff(day,(select max(BDate) from CurrentAccounts where BNo =@No),@Date))/360.0*0.0035+1)*(select BMoney from CurrentAccounts where nID =(select max(temp.nID)from (select nID from CurrentAccounts where BNo = @No)as temp)))+@Money --当前余额if(@Money > 0)--存款begininsert intoCurrentAccounts(BNo,BName,BStyle,BCash,BDate,BInterest,BM oney)values(@No,(select distinct BName from CurrentAccounts where BNo = @No),'活期存款',@Money,@Date,((select datediff(day,(select max(BDate) from CurrentAccounts where BNo =@No),@Date))/360.0*0.0035*(select BMoney from CurrentAccounts where nID =(select max(temp.nID)from (select nID from CurrentAccounts where BNo = @No)as temp))),--(6)利息计算@temp)select*from CurrentAccounts where nID =(select max(temp.nID)from (select nID from CurrentAccounts where BNo = @No)as temp)--显示存款记录endelse--取款if(abs(@Money)> @temp)print'余额不足!'elsebegininsert intoCurrentAccounts(BNo,BName,BStyle,BCash,BDate,BInterest,BM oney)values(@No,(select distinct BName from CurrentAccounts where BNo = @No),'活期取款',abs(@Money),@Date,((select datediff(day,(select max(BDate) from CurrentAccounts where BNo =@No),@Date))/360.0*0.0035*(select BMoney from CurrentAccounts where nID =(select max(temp.nID)from (select nID from CurrentAccounts where BNo = @No)as temp))),@temp)select*from CurrentAccounts where nID =(select max(temp.nID)from (select nID from CurrentAccounts where BNo = @No)as temp)--显示取款记录endexec CurrentWithdraw10001,5000,' -03-30' --存款exec CurrentWithdraw10001,-5000,' -05-30' --取款exec CurrentWithdraw10001,5000,' -07-30'--存款exec CurrentWithdraw10001,- 0,' -08-30'--取款,返回消息:余额不足!(7)活期明细create proc DetailOfCurrentAccount --活期明细@no varchar(20)asselect*from CurrentAccounts where BNo = @no exec DetailOfCurrentAccount10001定期明细create proc DetailOfFixedAccount --定期明细@no varchar(20)asselect*from FixedAccounts where BNo = @no exec DetailOfFixedAccount10003(8)数据库备份与恢复使用图形化界面操作即可。
软件工程课程设计银行储蓄管理系统教程文件
软件工程课程设计银行储蓄管理系统目录1 问题定义 (3)2 可行性研究 (3)2.1 项目概述 (3)2.2 可行性分析的前提 (4)2.2.1 项目的目标 (4)2.2.2 项目的环境 (4)2.3 可选的方案 (5)2.3.1 方案一 (5)2.3.2 方案二 (5)2.4 所建议的系统 (5)2.4.1 系统说明 (5)2.4.2 系统流程图 (5)2.4.3 高级数据流图 (6)2.5 经济可行性 (7)2.5.1系统开发费用 (7)2.5.2系统运行费用 (7)2.5.3效益 (7)2.6技术可行性 (8)2.7 操作可行性 (8)3 需求分析 (8)3.1 需求概述 (8)3.2 需求模型 (9)3.2.1 数据模型 (9)3.2.2 功能模型 (10)3.2.3 行为模型 (11)3.2.4 数据字典 (12)4 总体设计 (14)4.1 系统体系结构 (14)4.2 模块详细说明 (15)4.3 数据库设计 (16)5 详细设计 (18)5.1 人机界面设计 (18)5.2 过程设计 (22)6 测试 (22)6.1 白盒测试 (22)6.2黑盒测试 (23)7 结论 (24)8参考文献 (25)9 附录 (25)9.1程序代码 (25)1 问题定义账户管理是银行业务流程过程中十分重要且必备的环节之一,在银行业务流程当中起着承上启下的作用,其重要性不言而喻。
但是,目前许多银行在具体的业务流程处理过程中仍然使用手工操作的方式来实施,不仅费时、费力,效率低下,而且无法达到理想的效果。
本文针对上述问题,采用软件工程的开发原理,依据软件流程过程规范,按照需求分析、概要设计、详细设计、程序编码、测试、软件应用、软件维护等过程开发了一个银行账户管理系统。
采用VSC++作为开发工具,数据库设计遵循3范式,主要设计了用户基本信息表、用户卡信息表、ATM取款机基本信息表、用户银行存款信息表、管理系统的用户口令表、银行系统的用户信息表等数据表。
原创java银行账户管理系统代码
原创Java银行账户管理系统代码
简介
本文档将介绍一个原创的Java银行账户管理系统代码。
该代码用于模拟一个简单的银行账户管理系统,包括账户的创建、存款、取款、查询余额等功能。
功能列表
•创建账户:根据用户输入的账户信息,创建新的银行账户。
•存款:将用户输入的金额存入指定账户。
•取款:从指定账户中取出用户指定的金额。
•查询余额:根据用户输入的账户信息,查询指定账户的余额。
开发工具和环境
•开发语言:Java
•开发环境:Eclipse IDE
•JDK版本:Java SE 8
代码实现
下面是代码的具体实现。
```java import java.util.HashMap; import java.util.Map; import java.util.Scanner;
public class BankAccountManagementSystem {
private static Map<String, Double> accountMap = new HashMap<>();
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
boolean running = true;
while (running) {
System.out.println(\。
银行账户管理系统C语言源代码[新版].doc
FILE* file;
file = fopen(cFile, "a");
if (!file) return 0;
fprintf(file, "%s %s %.2lf\n", user, pwd, coin_n);
fclose(file);
return 0;
}
int wenjian(char* user, char* pwd,double coin)
char sh[18];
int n;
p=(struct bank*)malloc(sizeof(struct bank));/*给p分配内存*/
welcome2();
printf("请输入您的名字(纯英文):");
gets(name);
printf("请输入您的性别(男:1女2):");
fflush(stdin);
}
else/*如有相同帐号,注册失败*/
{
system("cls");
printf("您输入的帐号已经存在!注册失败!\n");
printf("请选择:按1返回主页面.按任意键退出:");
scanf("%c",&ch);
if(ch=='1'){system("cls");main();}
else exit(0);
fflush(stdin);
scanf("%c",&ch);
fflush(stdin);
if(ch=='1'){system("cls");main();}
Java-银行管理系统源代码
Java 小型银行管理系统源代码(图形界面)accounts.javapackage Account;public class accounts {protected int id;// 银行账号protected String password;// 用户密码protected String name;// 用户型号protected String personId;// 身份账号protected int accountType;// 账号类型,0 代表储蓄卡, 1 代表信用卡protected double balance;// 账户余额。
之所以定义为protected 是让他的子类可以直接用,不需要通过方法来赋值。
protected double ceiling;public String getPassword(){return password;}public void setPassword(String password){this.password=password;}public String getName(){return name;}public void setName(String name){=name;}public String getPersonId(){return personId;}public void setPersonId(String personId){this.personId=personId;}public int getAccountType(){return accountType;}public void setAccountType(int accountType){this.accountType=accountType;}public double getBalance(){return balance;}public void setBalance(double balance){this.balance=balance;}public int getId(){return id;}public void setId(int id){this.id=id;}public double getCeiling(){return ceiling;}public void setCeiling(double ceiling){this.ceiling=ceiling;}// 无参数构造方法public accounts(){}// 构造方法public accounts(String password,String name,String personId,int accountType, double balance,double ceiling){super();this.password=password;=name;this.personId=personId;this.accountType=accountType;this.balance=balance;this.ceiling=ceiling;}// 存款public void deposit(double money){balance+=money;}// 取款public void withdraw(double money){if(accountType==1){if((balance+ceiling)<money){System.out.println(" 对不起,已超出您的信用额度!");}else{balance-=money;}}else{if(balance<money){System.out.println(" 对不起,账户余额不足!");}else{balance-=money;}}}}DBoper.javapackage DB;import java.sql.*;import java.util.ArrayList;import Account.accounts;public class DBoper {private Connection conn = null;private Statement st = null;private PreparedStatement pstmt = null;private ResultSet rs = null;private ArrayList<accounts> result;// 连接数据库public Connection getConnection(){try{Class.forName("com.mysql.jdbc.Driver");conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/bankmanager?useUnicode=true&characterEncoding=utf8","root","xuewei");}catch(Exception e){System.out.println(" 数据库连接失败");}return conn;}// 修改删除用户数据public boolean accountDataUpdate(String sql){conn=getConnection();try{pstmt=conn.prepareStatement(sql);pstmt.executeUpdate();//System.out.println(" 数据更新成功");conn.close();return true;}catch(SQLException e){e.printStackTrace();//System.out.println(" 更新失败");return false;}}// 依据id 来修改记录public boolean dataupdateid(accounts user, int id) {conn = getConnection();try {String sql = "update account set username=?,userpwd=?,personId=?,accountType=?,balance=?,ceiling=? where id="+ id;pstmt = conn.prepareStatement(sql);pstmt.setString(1, user.getName());pstmt.setString(2, user.getPassword());pstmt.setString(3, user.getPersonId());pstmt.setInt(4, user.getAccountType());pstmt.setDouble(5, user.getBalance());pstmt.setDouble(6, user.getCeiling());pstmt.executeUpdate();System.out.println(" 操作成功");return true;}catch (SQLException e) {e.printStackTrace();System.out.println(" 操作失败");return false;}}// 插入用户数据public boolean accountDataInsert(accounts account){conn=getConnection();try{pstmt=conn.prepareStatement("insert into account (username,userpwd,personId,accountType,balance,ceiling) values (?,?,?,?,?,?)");pstmt.setString(1, account.getName());pstmt.setString(2, account.getPassword());pstmt.setString(3, account.getPersonId());pstmt.setInt(4, account.getAccountType());pstmt.setDouble(5, account.getBalance());pstmt.setDouble(6, account.getCeiling());pstmt.executeUpdate();System.out.println(" 新用户数据插入成功");conn.close();return true;}catch(SQLException e){e.printStackTrace();System.out.println(" 插入失败");return false;}}// 查询数据public ResultSet dataquery(String sql) {conn = getConnection();try {pstmt = conn.prepareStatement(sql);rs = pstmt.executeQuery();}catch (SQLException e) {e.printStackTrace();System.out.println(" 检索失败");}return rs;}public ResultSet testlist() {try {String sql = "select * from account where id =1001";pstmt = conn.prepareStatement(sql);System.out.println(sql);rs = pstmt.executeQuery();} catch (SQLException e) {e.printStackTrace();System.out.println(" 检索失败");}return rs;}public ArrayList<accounts> testt(int id) {ArrayList<accounts> list = new ArrayList<accounts>();conn = getConnection();try {String sql = "select * from account where id=" + id;pstmt = conn.prepareStatement(sql);rs = pstmt.executeQuery();while (rs.next()) {accounts user = new accounts();user.setName(rs.getString("username"));user.setPassword(rs.getString("userpwd"));user.setPersonId(rs.getString("personId"));user.setAccountType(rs.getInt("accountType"));user.setBalance(rs.getDouble("balance"));user.setCeiling(rs.getDouble("ceiling"));list.add(user);}}catch (SQLException e) {e.printStackTrace();System.out.println(" 检索失败");}return list;}// 根据卡号和密码验证用户是否存在public boolean verify(int id,String password){conn=getConnection();try{pstmt=conn.prepareStatement("select * from account where id=? and userpwd=?");pstmt.setInt(1, id);pstmt.setString(2, password);rs=pstmt.executeQuery();if(rs.next()){return true;}else{return false;}}catch(SQLException e){e.printStackTrace();return false;}}/*** 登录验证*/public accounts verifyAccount(int id, String password) {boolean flag = verify(id, password);if(flag){accounts account=queryByIDandPassword(id, password);return account;}else{System.out.println(" 用户不存在!");return null;}}// 根据卡号和密码查询信息public accounts queryByIDandPassword(int id,String password){conn=getConnection();try{pstmt=conn.prepareStatement("select * from account where id=? and userpwd=?");pstmt.setInt(1, id);pstmt.setString(2, password);rs=pstmt.executeQuery();accounts account=new accounts();while(rs.next()){account.setId(rs.getInt("id"));account.setName(rs.getString("username"));account.setPassword(rs.getString("userpwd"));account.setPersonId(rs.getString("personId"));account.setAccountType(rs.getInt("accountType"));account.setBalance(rs.getDouble("balance"));account.setCeiling(rs.getDouble("ceiling"));}return account;}catch(SQLException e){e.printStackTrace();return null;}}// 根据卡号查询信息public accounts queryByID(int id){conn=getConnection();try{pstmt=conn.prepareStatement("select * from account where id=?");pstmt.setInt(1, id);rs=pstmt.executeQuery();accounts account=new accounts();while(rs.next()){account.setId(rs.getInt("id"));account.setName(rs.getString("username"));account.setPassword(rs.getString("userpwd"));account.setPersonId(rs.getString("personId"));account.setAccountType(rs.getInt("accountType"));account.setBalance(rs.getDouble("balance"));account.setCeiling(rs.getDouble("ceiling"));}return account;}catch(SQLException e){e.printStackTrace();return null;}}public static void main(String[] args) {// TODO Auto-generated method stubDBoper op=new DBoper();ArrayList<accounts> list=op.testt(1001);for(int i=0;i<list.size();i++){accounts user=new accounts();user=list.get(i);System.out.println(user.getName());System.out.println(user.getPassword());System.out.println(user.getPersonId());System.out.println(user.getAccountType());System.out.println(user.getBalance());System.out.println(user.getCeiling());}}}// 图像界面文件夹DN_SYSTEMDefault.java // 主界面package DN_SYSTEM;import java.awt.Color;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.WindowConstants;import Account.accounts;import DB.DBoper;public class Default extends JFrame implements ActionListener{accounts account=DN_ATM.client;DBoper db=new DBoper();private JFrame jf;private JButton btn0,btn1,btn2,btn3,btn4,btn5;private Container c;public void defaltDemo() {// 添加主界面卡片//DN_ATM.id;int id=DN_ATM.id;//account=db.queryByID(id);jf=new JFrame("DEFAULT");c=jf.getContentPane();c.setLayout(null);c.setBackground(new Color(119,119,253));JLabel lblwel = new JLabel("欢迎"+account.getName()+" 用达能银行ATM系统");lblwel.setBounds(20, 15, 350, 30);c.add(lblwel);JLabel lblwel1 = new JLabel("请选择您需要的交易类型");lblwel1.setBounds(120, 45, 350, 30);c.add(lblwel1);btn1 = new JButton(" 取款服务");btn1.addActionListener(this);btn1.setBounds(70, 90, 100, 30);c.add(btn1);btn2=new JButton(" 存款服务");btn2.addActionListener(this);btn2.setBounds(210, 90, 100, 30);c.add(btn2);btn3 = new JButton(" 查询余额");btn3.addActionListener(this);btn3.setBounds(70, 150, 100, 30);c.add(btn3);btn4 = new JButton(" 转账服务");btn4.addActionListener(this);btn4.setBounds(210, 150, 100, 30);c.add(btn4);btn5 = new JButton(" 注销账户");btn5.addActionListener(this);btn5.setBounds(70, 210, 100, 30);c.add(btn5);btn0 = new JButton(" 退出操作");btn0.addActionListener(this);btn0.setBounds(210, 210, 100, 30);c.add(btn0);jf.setVisible(true);jf.setResizable(false);jf.setSize(400,300);jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }// 事件处理@Overridepublic void actionPerformed(ActionEvent e){// 取款服务if(e.getSource().equals(btn1)){OutMoney outmoney=new OutMoney();outmoney.outMoney();jf.dispose();}// 存款服务if(e.getSource().equals(btn2)){InMoney inmoney=new InMoney();inmoney.InMoney();jf.dispose();}// 查询余额if(e.getSource().equals(btn3)){GetBalance getbalance=new GetBalance();getbalance.getBalance();jf.dispose();}// 转账服务if(e.getSource().equals(btn4)){TransferAccounts tranfer=new TransferAccounts();tranfer.transferAccounts();jf.dispose();}// 注销账户if(e.getSource().equals(btn5)){String sql="delete from account where id="+account.getId();boolean flag=db.accountDataUpdate(sql);if(flag){JOptionPane.showMessageDialog(this," 注销成功!");}else{JOptionPane.showMessageDialog(this, " 注销失败!");}}if(e.getSource().equals(btn0)){System.exit(0);}}public static void main(String[] args) {// TODO Auto-generated method stubDefault defaults=new Default();defaults.defaltDemo();}}DN_ATM.java // 功能界面package DN_SYSTEM;import java.awt.CardLayout;import java.awt.Color;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.AbstractButton;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;import DB.DBoper;import Account.accounts;public class DN_ATM extends JFrame implements ActionListener{ private JLabel lbljixu;private JButton btngetcard;private JButton btncard,btn010,btn_addAccount,btnsure,btnback;private JTextField txt1;private JPasswordField txt2;private Container container;private CardLayout Layout;private JLabel lblwrong;private JPanel panelfirst,panelmain;public static int id;static accounts client = null;public DN_ATM(){super("达能银行");this.setSize(435, 350);this.setLocation(500,250);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// 设置不可改变窗口大小this.setResizable(false);}// 布局public void setLayout(){// 用卡片布局Layout = new CardLayout();container = getContentPane();container.setLayout(Layout);// 添加第一张卡片panelfirst = new JPanel(null);// 设置卡片的背景颜色panelfirst.setBackground(new Color(119,119,253));lbljixu = new JLabel(" 请放入磁卡,然后继续操作");// 设置卡片在Panel 中的位置lbljixu.setBounds(140, 90, 350, 30);// 为第一张卡片添加一个Labelpanelfirst.add(lbljixu);// 为第一张卡片添加一个按钮btncard = new JButton(" 继续");btncard.setBounds(310, 180, 80, 30);// 为按钮注册事件监听器btncard.addActionListener(this);// 开始时设置按钮不可按btncard.setEnabled(false);panelfirst.add(btncard);// 为第一张卡片添加一个按钮btngetcard = new JButton(" 取卡");btngetcard.setEnabled(false);btngetcard.setBounds(310, 220, 80, 30);btngetcard.addActionListener(this);panelfirst.add(btngetcard);// 添加登录输入卡片panelmain = new JPanel(null);panelmain.setBackground(new Color(119,119,253));// 添加登录输入卡号JLabel lblnumber = new JLabel("请输入您的银行卡卡号:"); panelmain.add(lblnumber);lblnumber.setBounds(30, 30, 150, 30);// 设置文本框为密码型txt1 = new JTextField(12);// 文本框不可选中//txt1.enable(false);panelmain.add(txt1);txt1.setBounds(170, 30, 200, 30);JLabel lblpwd = new JLabel("请输入您的银行卡密码:"); panelmain.add(lblpwd);lblpwd.setBounds(30, 80, 150, 30);// 设置文本框为密码型txt2 = new JPasswordField(12);// 文本框不可选中//txt2.enable(false);panelmain.add(txt2);// 文本框的输入内容用* 显示txt2.setEchoChar('*');txt2.setBounds(170, 80, 200, 30);// 添加选择按钮btnsure = new JButton(" 确定");btnsure.addActionListener(this);panelmain.add(btnsure);btnsure.setBounds(70, 160, 80, 30);// 添加重输按钮btn010 = new JButton(" 重输");btn010.addActionListener(this);panelmain.add(btn010);btn010.setBounds(175,160,80,30);btnback = new JButton(" 退出");btnback.addActionListener(this);panelmain.add(btnback);btnback.setBounds(280, 160, 80, 30);// 开户btn_addAccount = new JButton(" 开户");btn_addAccount.setBounds(70, 220, 80, 30);btn_addAccount.addActionListener(this);panelmain.add(btn_addAccount);lblwrong = new JLabel(" 请注意保护好您的密码!");panelmain.add(lblwrong);lblwrong.setBounds(180, 110, 200, 30);container.add(panelmain, "main");}// 事件处理@SuppressWarnings("deprecation")@Overridepublic void actionPerformed(ActionEvent e){DBoper db=new DBoper();if(e.getSource().equals(btn_addAccount)){OpenAccount open=new OpenAccount();open.adduser();}// 磁卡插入后,验证银行登录卡号与密码if(e.getSource().equals(btnsure)){client = db.verifyAccount(Integer.parseInt(txt1.getText()), txt2.getText());if(client!=null){Default defa=new Default();defa.defaltDemo();this.dispose();id=Integer.parseInt(txt1.getText());txt1.setText("");txt2.setText("");}else{lblwrong.setText(" 卡号或密码不正确,请重新输入!");txt1.setText("");txt2.setText("");}}// 重置输入卡号和密码if(e.getSource()==btn010){txt1.setText("");txt2.setText("");lblwrong.setText(" 请注意保护好您的密码!");}// 退出if(e.getSource().equals(btnback)){System.exit(0);}}public static void main(String[] args) {// TODO Auto-generated method stubDN_ATM ATM=new DN_ATM();ATM.setLayout();ATM.setVisible(true);}}GetBalance.java // 查询余额package DN_SYSTEM;import java.awt.CardLayout;import java.awt.Color;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.WindowConstants;import Account.accounts;import DB.DBoper;public class GetBalance extends JFrame implements ActionListener{ private JFrame jf;private Container c;private JLabel lblremain1,lblremain;private JButton btnremain,btnremain1;accounts account=new accounts();DBoper db=new DBoper();private int id=DN_ATM.id;// 添加查询余额界面卡片public void getBalance(){account=db.queryByID(id);jf=new JFrame("FIND DALANCE");c=jf.getContentPane();c.setLayout(null);jf.setResizable(false);c.setBackground(new Color(119,119,253));lblremain1 = new JLabel(" 尊敬的达能用户您好!");lblremain1.setBounds(90,70,350,30);c.add(lblremain1);lblremain = new JLabel(" 请点击继续操作查询余额:");lblremain.setBounds(90,110,350,30);c.add(lblremain);btnremain = new JButton(" 继续操作");btnremain.setBounds(95,150,90,30);btnremain.addActionListener(this);c.add(btnremain);btnremain1 = new JButton(" 退出操作");btnremain1.setBounds(200,150,90,30);btnremain1.addActionListener(this);c.add(btnremain1);jf.setVisible(true);jf.setSize(400,300);jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);}@Overridepublic void actionPerformed(ActionEvent e){// 查询余额if(e.getSource()==btnremain){lblremain1.setText(" 卡号:"+account.getId()+" 用户名:"+account.getName());lblremain.setText(" 您的余额为"+account.getBalance()+" 元,是否继续操作?");}if(e.getSource()==btnremain1){Default defa=new Default();defa.defaltDemo();jf.dispose();}}public static void main(String[] args) {// TODO Auto-generated method stubGetBalance balance=new GetBalance();balance.getBalance();}}InMoney.java // 存款package DN_SYSTEM;import java.awt.CardLayout;import java.awt.Color;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JTextField;import javax.swing.WindowConstants;import Account.accounts;import DB.DBoper;public class InMoney extends JFrame implements ActionListener{private JLabel lblsave,lblsave1;private JButton btnsave,btnsave2;private JTextField txt2;private double savemoney ;private double lastmoney;private boolean flag;private JFrame jf;private Container c;accounts account=new accounts();DBoper db=new DBoper();private int id=DN_ATM.id;public void InMoney(){account=db.queryByID(id);jf=new JFrame("IN MONEY");c=jf.getContentPane();c.setLayout(null);jf.setResizable(false);// 添加存款显示界面卡片c.setBackground(new Color(119,119,253));lblsave = new JLabel("请在存款口处放入存款");lblsave.setBounds(60,30,350,30);c.add(lblsave);lblsave1 = new JLabel("请注意:只接收100 元或100 元的整数倍存款");lblsave1.setBounds(90,110,350,30);c.add(lblsave1);txt2 = new JTextField(12);c.add(txt2);txt2.setBounds(95, 80, 200, 30);btnsave = new JButton(" 放入存款完毕");btnsave.setBounds(90,160,120,30);btnsave.addActionListener(this);c.add(btnsave);btnsave2 = new JButton(" 返回");btnsave2.setBounds(240,160,60,30);btnsave2.addActionListener(this);c.add(btnsave2);jf.setVisible(true);jf.setSize(400,300);jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);}@Overridepublic void actionPerformed(ActionEvent e){if(e.getSource()==btnsave){savemoney=Double.parseDouble(txt2.getText());lastmoney=account.getBalance();lastmoney+=savemoney;String sql = "update account set balance="+lastmoney+"where id="+ id;flag=db.accountDataUpdate(sql);if(flag){JOptionPane.showMessageDialog(this, " 存款成功!");txt2.setText("");Default defa=new Default();defa.defaltDemo();jf.dispose();}else{JOptionPane.showMessageDialog(this, " 存款失败!");}}if(e.getSource()==btnsave2){Default defa=new Default();defa.defaltDemo();jf.dispose();}}public static void main(String[] args) {// TODO Auto-generated method stubInMoney inmoney=new InMoney();inmoney.InMoney();}}OpenAccount.java // 开户package DN_SYSTEM;import ponent;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.ButtonGroup;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPasswordField;import javax.swing.JRadioButton;import javax.swing.JTextField;import javax.swing.WindowConstants;import DB.DBoper;import Account.accounts;public class OpenAccount extends JFrame implements ActionListener{private JFrame jf;private Container c;private JTextField txtname,txt_personId;private JPasswordField txtpwd,txtpwd1;private JRadioButton rbt1;private JRadioButton rbt2;String accountType;// 开户,增加新用户public void adduser(){jf=new JFrame("Open Account");c=jf.getContentPane();c.setLayout(null);jf.setResizable(false);JLabel lbname=new JLabel("用户名:");lbname.setBounds(100, 40, 80, 20);txtname=new JTextField();txtname.setBounds(160, 40, 130, 20);c.add(lbname);c.add(txtname);JLabel lbpwd=new JLabel("密码:");lbpwd.setBounds(110, 65, 80, 20);txtpwd=new JPasswordField();txtpwd.setBounds(160, 65, 130, 20);txtpwd.setEchoChar('*');c.add(lbpwd);c.add(txtpwd);JLabel lbpwd1=new JLabel("确认密码:");lbpwd1.setBounds(86, 90, 80, 20);txtpwd1 = new JPasswordField();txtpwd1.setBounds(160, 90, 130, 20);txtpwd1.setEchoChar('*');c.add(lbpwd1);c.add(txtpwd1);JLabel lbpersonId=new JLabel("身份证号:");lbpersonId.setBounds(86, 115, 80, 20);txt_personId = new JTextField();txt_personId.setBounds(160, 115, 130, 20);c.add(lbpersonId);c.add(txt_personId);JLabel lbtype=new JLabel("账户类型:");lbtype.setBounds(86, 120, 80, 60);rbt1=new JRadioButton(" 信用卡");rbt1.setBounds(160, 135, 70, 30);rbt2=new JRadioButton(" 储蓄卡");rbt2.setBounds(225, 135, 70, 30);ButtonGroup group=new ButtonGroup();group.add(rbt2);group.add(rbt1);c.add(lbtype);c.add(rbt2);c.add(rbt1);JButton btnsubmit=new JButton(" 提交");btnsubmit.setBounds(100, 190, 80, 20);JButton btnreset=new JButton(" 重置");btnreset.setBounds(205, 190, 80, 20);c.add(btnsubmit);c.add(btnreset);btnsubmit.addActionListener(this);btnreset.addActionListener(this);jf.setVisible(true);jf.setSize(400,300);jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }public static void main(String[] args) {// TODO Auto-generated method stubOpenAccount openA=new OpenAccount();openA.adduser();}@Overridepublic void actionPerformed(ActionEvent e){accounts account=new accounts();account.setName(txtname.getText());if(txtpwd.getText().equals(txtpwd1.getText())){account.setPassword(txtpwd.getText());}else{JOptionPane.showMessageDialog(this," 两次输入的密码不一致,请重新输入!");}account.setPersonId(txt_personId.getText());if(rbt1.isSelected())accountType="1";if(rbt2.isSelected())accountType="0";account.setAccountType(Integer.parseInt(accountType));account.setBalance(0);if(accountType.equals("1")){account.setCeiling(5000.0);}else{account.setCeiling(0);}DBoper db=new DBoper();if(db.accountDataInsert(account)){JOptionPane.showMessageDialog(this," 开户成功!");jf.dispose();// 关闭当前登录窗体return;}else{JOptionPane.showMessageDialog(this," 开户失败!");return;}}}OutMoney.java // 取款package DN_SYSTEM;import java.awt.CardLayout;import java.awt.Color;import java.awt.Container;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.WindowConstants;import Account.accounts;import DB.DBoper;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class OutMoney extends JFrame implements ActionListener{private JFrame jf;private JButton btn100,btn200,btn300,btn500,btn1000;private JButton btn001,btn002,btn003,btn004,btn005,btn006,btn007,btn008,btn009,btn000;private JButton btnsure1,btn0010,btnback2;private JTextField txt2;private Container c;private JLabel lblqukuan;private int money;private double lastmoney;accounts account=new accounts();DBoper db=new DBoper();private int id=DN_ATM.id;public void outMoney(){account=db.queryByID(id);jf=new JFrame("OUT MONEY");c=jf.getContentPane();c.setLayout(null);jf.setResizable(false);// 添加取款页面卡片//panel4=new JPanel(null);c.setBackground(new Color(119,119,253));lblqukuan = new JLabel(" 请输入您的取款金额:");c.add(lblqukuan);lblqukuan.setBounds(115, 20, 150, 30);lblqukuan=new JLabel(" 提示:只能是100 元或100 元的整数倍");c.add(lblqukuan);lblqukuan.setBounds(115, 50, 300, 30);txt2 = new JTextField(12);txt2.enable(false);c.add(txt2);txt2.setBounds(115, 90, 200, 30);btn100 = new JButton("100");c.add(btn100);btn100.addActionListener(this);btn100.setBounds(45, 190, 60, 30);btn200 = new JButton("200");c.add(btn200);btn200.addActionListener(this);btn200.setBounds(115, 190, 60, 30);btn300 = new JButton("300");c.add(btn300);btn300.addActionListener(this);btn300.setBounds(185, 190, 60, 30);btn500 = new JButton("500");btn500=new JButton("500");c.add(btn500);btn500.addActionListener(this);btn500.setBounds(255, 190, 60, 30);btn1000 = new JButton("1000");c.add(btn1000);btn1000.addActionListener(this);btn1000.setBounds(325, 190, 65, 30);btn001 = new JButton("1");c.add(btn001);btn001.addActionListener(this);btn001.setBounds(45, 230, 60, 30);btn002 = new JButton("2");c.add(btn002);btn002.addActionListener(this); btn002.setBounds(115, 230, 60, 30);btn003 = new JButton("3");c.add(btn003);btn003.addActionListener(this); btn003.setBounds(185, 230, 60, 30);btn004 = new JButton("4");c.add(btn004);btn004.addActionListener(this); btn004.setBounds(255, 230, 60, 30);btn005 = new JButton("5");c.add(btn005);btn005.addActionListener(this); btn005.setBounds(325, 230, 65, 30);btn006 = new JButton("6");c.add(btn006);btn006.addActionListener(this); btn006.setBounds(45, 270, 60, 30);btn007 = new JButton("7");c.add(btn007);btn007.addActionListener(this); btn007.setBounds(115, 270, 60, 30);btn008 = new JButton("8");c.add(btn008);btn008.addActionListener(this); btn008.setBounds(185, 270, 60, 30);btn009 = new JButton("9");c.add(btn009);btn009.addActionListener(this); btn009.setBounds(255, 270, 60, 30);btn000 = new JButton("0");c.add(btn000);btn000.addActionListener(this); btn000.setBounds(325, 270, 65, 30);btnsure1 = new JButton(" 确定");。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
package src.day01;public class ACC {//父类,以下是共有属性和方法//卡号protected static long id;// 名字protected static String name;// 身份证protected static String personId;//电子邮件protected static String email;// 密码protected static long password;//余额protected static double balance;public ACC(){}public ACC(long id,String name,String personId,String email,long password,double balance ){this.id = id; = name;this.personId = personId;this.email = email;this.password = password;this.balance = balance;}// 存款方法public static void deposit(double money){balance += money;System.out.println("存款成功,你存入的金额为:" + money); }public long getId() {return id;}public void setId(long id) {this.id = id;}public String getName() {return name;}public void setName(String name) { = name;}public String getPersonId() {return personId;}public void setPersonId(String personId) {this.personId = personId;}public String getEmail() {return email;}public void setEmail(String email) {this.email = email;}public long getPassword() {return password;}public void setPassword(long password) {this.password = password;}public double getBalance() {return balance;}public void setBalance(double balance) {this.balance = balance;}}package src.day01;import java.util.*;public class Bank {//先定义两个动态数组,其中ban用来存储借记卡数据,ba用来存储信用卡数据static Vector ban = new Vector();static Vector ba = new Vector();//i指借记卡卡号,每增加一个用户,i自增1//j指借记卡卡号,每增加一个用户,j自增1private static long i = 110000000;private static long j = 610000000;public Bank(){}//判断用户办理借记卡还是信用卡的相关业务public static void justy(int ch){boolean k = true ;while(k){if(ch ==1){System.out.println("你将要办理借记卡业务:");break;}else if(ch ==2){System.out.println("你将要办理信用卡业务:");break;}else{System.out.println("输入指令错误,请重新输入:");k=false;}}}//开户方法public static void register(int ch){justy(ch);Scanner re = new Scanner(System.in);System.out.println("请输入开户的用户名:");String na =re.next();long key;//两次密码不同的话循环进行p: while (true){System.out.println("请输入密码:");long pa = re.nextLong();System.out.println("请再次输入密码:");long pa1 = re.nextLong();if(pa==pa1 ){key = pa1;break ;}else{System.out.println("两次不相同,请重新输入");continue p;}}System.out.println("请输入身份证号:");String perId = re.next();System.out.println("请输入email地址:");String em = re.next();System.out.println("请输入开户金额:");double bal = re.nextDouble();//存储和输出过程,将以上输入的正确数据存储到相应的数组中 if(ch==1){ DebitAcc De = newDebitAcc(i,na,perId,em,key,bal);ban.add(De);System.out.println("恭喜你开户成功:你的卡号为" + i);i++;}else if(ch==2){CreditAcc Cr = new CreditAcc(j,na,perId,em,key,bal);ba.add(Cr);System.out.println("恭喜你开户成功:你的卡号为" + j);j++;}System.out.println( "用户名: " + na );System.out.println("身份证:"+ perId );System.out.println("email:" +em );System.out.println("开户金额:" + bal );}//用户子菜单public static void MenuCu(){Scanner sc = new Scanner(System.in);while(true){System.out.println("欢迎使用银行系统");System.out.println("请输入指令:1、开户 2 、登陆 3、退出到上级");int choice = sc.nextInt();switch(choice){case 1:openAccount();break;case 2:logIn();break;case 3:return;default :System .out .println("输入指令错误,请重新输入");break;}}}//开户方法总方法private static void openAccount(){System.out.println("你将要办理开户业务:");System.out.println("请输入你要选择的银行卡类型: 1、借记卡 2、信用卡 ");Scanner op = new Scanner(System.in);int ch = op.nextInt();register(ch);}//用户登陆总方法public static void logIn( ){System.out.println("欢迎进入用户登陆界面,请选择你要登陆的卡号类型: 1、借记卡 2、信用卡" );boolean o = true;boolean p =false;Scanner lo = new Scanner(System.in);int ch = lo.nextInt();justy(ch);l: while(o) {System.out.println("请输入你的卡号:");long user = lo. nextLong();if(ch==1){//调用对应数组的卡号群与输入卡号匹配,以下同理 for(int i = 0;i<Bank.ban.size();i++){DebitAcc d = (DebitAcc)Bank.ban.get(i);if(user == d.id){System.out.println("请输入密码:");long password = lo.nextLong();//对密码进行正误判断,正则p为true,可向下进行,false则直接返回输入卡号命令,即只有输密码一次机会p = pass(password) ;while(p){d.menu1();break;}}else{//卡号不存在进行的操作System.out.println("该卡号不存在,是否重新输入:1、继续2、返回上一级");int c =lo.nextInt();if(c==1){continue l;}else{return;}}}}else {for(int j =0;j<Bank.ba.size();j++){CreditAcc c = (CreditAcc)Bank.ba.get(j);if(user==c.id){System.out.println("请输入密码:");long password = lo.nextLong();p = pass(password) ;while(p){c.menu1();break;}}else{System.out.println("该卡号不存在,请重新输入:");continue l;}}}}}//密码正误判断方法public static boolean pass( long password){if(password !=DebitAcc.password){System.out.println("密码错误!重新输入:");return false;}else{return true;}}//管理员操作菜单public static void menuAd(){Scanner mc = new Scanner(System.in);while(true){System.out.println("欢迎使用银行系统");System.out.println("请输入指令:1、查看所有用户余额 2 、查看信用卡用户总信用额度 3、退出到上级");int m =mc.nextInt();switch(m){case 1:checkBalance();break;case 2:checkCeiling();break;case 3:return;default:System.out.println("输入错误,请重试:");break;}}}//营业员查询总余额public static void checkBalance(){double k =0.0;for(int i = 0;i<Bank.ban.size();i++){DebitAcc d = (DebitAcc)Bank.ban.get(i);k += d.balance;}for(int j=0;j<Bank.ba.size();j++){CreditAcc c = (CreditAcc)Bank.ba.get(j);k+=c.balance;}System.out.println("本银行账户的总余额为:" + k);}public static void checkCeiling(){double k =0.0;for(int j=0;j<Bank.ba.size();j++){CreditAcc c = (CreditAcc)Bank.ba.get(j);k+=c.ceiling;}System.out.println("本银行信用卡账户的总信用度为:" + k);}//银行系统总菜单public static void menuWel(){Scanner b = new Scanner(System.in);while(true){System.out.println("欢迎使用银行系统");System.out.println("请输入指令:1、营业管理员 2、普通用户 3、退出");int ba =b.nextInt();switch(ba){case 1:menuAd();break;case 2:MenuCu();break;case 3:System .out .println("感谢你的使用,欢迎下次光临");System.exit(0);}}}}package src.day01;import java.util.*;public class CreditAcc extends ACC {//信用卡子类先定义信用额度为一常量public double ceiling = 500.0;CreditAcc(){super();}CreditAcc(long id,String name,String personId,String email,long password,double balance){super(id,name,personId,email,password,balance);}//取款方法public void withdraw(double money){if(money>balance){System.out.println("你的余额已不足,是否透支?1.透支2.不透支");Scanner cr = new Scanner (System.in);int c = cr.nextInt();switch(c){case 1:if(ceiling + balance<money){System.out.println("信用度不足,无法透支,请重新输入");}else{ceiling = (ceiling +balance)-money;balance = 0;}break;case 2:break;default:System.out.println("操作错误,请重新输入");break;}}}//查询方法public void show(){System.out.println("姓名:" +name +" 卡号:" + id);if(balance==0){System.out.println("你的余额为0,信用度为:" + ceiling);}else{System.out.println("你的余额为:" + balance);}}// 信用卡子菜单public static void menu1(){boolean b=true;while(b){System .out.println("请输入指令:1、取款2、存款3、查询4、退出到上级");Scanner men = new Scanner(System.in);int m =men.nextInt();switch(m){case 1:System.out.println("请输入取款金额:");double money = men.nextDouble();DebitAcc.withdraw(money);break;case 2:System.out.println("请输入存款金额:");double money1 = men.nextDouble();DebitAcc.deposit(money1);break;case 3:DebitAcc.show();break;case 4:return;}}}}package src.day01;import java.util.Scanner;public class DebitAcc extends ACC {//借记卡子类DebitAcc(){super();}DebitAcc(long id,String name,String personId,String email,long password,double ancbalancee){super(id,name,personId,email,password,ancbalancee) ;}//借记卡子菜单public static void menu1(){boolean b=true;while(b){System .out.println("请输入指令:1、取款2、存款3、查询4、退出到上级");Scanner men = new Scanner(System.in);int m =men.nextInt();switch(m){case 1:System.out.println("请输入取款金额:");double money = men.nextDouble();DebitAcc.withdraw(money);break;case 2:System.out.println("请输入存款金额:");double money1 = men.nextDouble();DebitAcc.deposit(money1);break;case 3:DebitAcc.show();break;case 4:return;}}}//取款方法,不可透支public static void withdraw(double money){if(money> balance){System.out.println("你的余额已不足,无法透支,请你重新输入:");return;}balance-=money;}//查询方法public static void show(){System.out.println("姓名:" +name +" 卡号:" + id);System.out.println("你的余额为:" + balance);}}package src.day01;public class Welbank {/*** @param args*/public static void main(String[] args) {// 银行系统主方法Bank bank = new Bank();bank. menuWel();}}。