简易ATM管理系统
博客班级 | https://edu.cnblogs.com/campus/ahgc/AHPU-SE-19/ |
作业要求 | https://edu.cnblogs.com/campus/ahgc/AHPU-SE-19/homework/11477 |
作业目标 | ATM管理系统 |
学号 | 3190704116 |
一、主菜单与操作菜单
void ATM::debitmenu() { system("cls"); cout << endl << endl << endl << endl << " 请选择操作序号!(0~6)" << endl; cout << " **********************************************************" << endl; cout << " * *" << endl; cout << " * 1.注册 *" << endl; cout << " * 2.销户 *" << endl; cout << " * 3.查询 *" << endl; cout << " * 4.存款 *" << endl; cout << " * 5.取款 *" << endl; cout << " * 6.转账 *" << endl; cout << " * 7.退出 *" << endl; cout << " * *" << endl; cout << " **********************************************************" << endl; }
void ATM::debitoperate() { while(true) { debitmenu(); int choice; cout << "请输入您的选择:"; cin >> choice; switch (choice) { case 1: zhuce(); break; case 2: xiaohu(); break; case 3: query(); break; case 4: savemoney(); break; case 5: getmoney(); break; case 6: zhuanzhang(); break; case 7:cout << "欢迎下次使用!"; exit(0); break; cout << endl << endl; default: cout << "输入错误!\n"; } system("cls"); } }
二、用户注册
void ATM::zhuce() { cout << "请输入姓名:"; cin >> name1; cout << "请输入6位数的密码:"; cin >> password1; if(name==name1&&password==password1) cout << "开户成功!" << endl; system("pause"); }
运行结果:
三、查询
void ATM::query() { cout << "请输入姓名:"; cin >> name1; cout << "请输入6位数的密码:"; cin >> password1; if (name == name1 && password == password1) cout << "您的账户余额为:" << money << endl; else cout << "账号或密码不对!" << endl; system("pause"); }
运行结果:
四、存款
void ATM::savemoney() { float money1; cout << "请输入存款金额:"; cin >> money1; money += money1; cout << "存钱成功!"<<endl<<"账户余额为:"<<money<<endl; system("pause"); }
运行结果:
五、取款
void ATM::getmoney() { float money2; cout << "请输入所取金额:"; cin >> money2; if (money >= money2) { money -= money2; cout << "取款成功!请取回现金!" << endl<<"账户余额为:" << money <<endl; } else cout << "金额不足!"; system("pause"); }
运行结果:
六、转账
void ATM::zhuanzhang() { string name1; float money1; cout << "请输入转账人的姓名:"; cin >> name; cout << "请输入转账金额:"; cin >> money1; if (money >= money1) { cout << "转账成功!" << endl; money = money - money1; cout << "账户余额为:" <<money<< endl; } else cout << "余额不足!" << endl; system("pause"); }
运行结果:
七、用户销户
void ATM::xiaohu() { cout << "请输入销户账户的姓名:"; cin >> name1; cout << "请输入6位数的密码:"; cin >> password1; if (name == name1 && password == password1) cout << "销户成功!" << endl; else cout << "账号或密码不对!" << endl; system("pause"); }
运行结果:
八、主函数
int main() { ATM atm; atm.debitoperate(); return 0; }
psp2.1 | 任务内容 | 计划完成需要的时间(min) | 实际完成需要的时间(min) |
Planning | 计划 | 120 | 100 |
Estimate | 估计这个任务需要多少时间,并规划大致工作步骤 | 90 | 80 |
Development | 开发 | 150 | 140 |
Analysis | 需求分析(包括学习新技术) | 16 | 15 |
Design Spec | 生成设计文档 | 12 | 13 |
Design Review | 设计复审 | 18 | 12 |
Coding Standard | 代码规范 | 15 | 11 |
Design | 具体设计 | 15 | 21 |
Coding | 具体编码 | 38 | 30 |
Code Review | 代码复审 | 16 | 18 |
Test | 测试(自我测试,修改代码,提交修改) | 15 | 18 |
Reporting | 报告 | 18 | 12 |
Test Report | 测试报告 | 12 | 15 |
Size Measurement | 计算工作量 | 6 | 10 |
Postmortem & Process Improvement Plan | 事后总结,并提出过程改进计划 | 8 |
6 |