ATM管理系统
一、题目要求
编写一个ATM管理系统,语言不限,要求应包括以下主要功能:
(1)开户,销户
(2)查询账户余额
(3)存款
(4)取款
(5)转账(一个账户转到另一个账户)等
二.代码提交
开户
public static void account()
{
System.out.print("请输入用户名:");
Scanner name1=new Scanner(System.in);
name=name1.nextLine();
System.out.print("请输入密码:");
Scanner passworld1=new Scanner(System.in);
passworld=passworld1.nextLine();
user.put(name,passworld);
message.put(name,0f);
System.out.println("开户成功");
}
销户
public static void selling()
{
System.out.print("请输入用户名:");
Scanner name1=new Scanner(System.in);
name=name1.nextLine();
System.out.print("请输入密码:");
Scanner passworld1=new Scanner(System.in);
passworld=passworld1.nextLine();
if(user.containsKey(name))
{
String mypassworld=user.get(name);
if(mypassworld.equals(passworld))
{
user.remove(name);
message.remove(name);
System.out.println("销户成功");
}
else
System.out.println("用户密码不正确");
}
else
System.out.println("不存在该用户");
}
余额查询
public static void inquire() {//余额查询
System.out.print("请输入用户名:");
Scanner name1=new Scanner(System.in);
name=name1.nextLine();
System.out.print("请输入密码:");
Scanner passworld1=new Scanner(System.in);
passworld=passworld1.nextLine();
if(user.containsKey(name))
{
String mypassworld=user.get(name);
if(mypassworld.equals(passworld)) {
amount=message.get(name);
System.out.printf("你的余额为:"+"%.2f",amount);
System.out.println();
}
else
System.out.println("用户密码不正确");
}
else
System.out.println("不存在该用户");
}
存款
public static void deposit() {//存款
System.out.print("请输入用户名:");
Scanner name1=new Scanner(System.in);
name=name1.nextLine();
System.out.print("请输入密码:");
Scanner passworld1=new Scanner(System.in);
passworld=passworld1.nextLine();
if(user.containsKey(name))
{
String mypassworld=user.get(name);
if(mypassworld.equals(passworld)) {
amount=message.get(name);
System.out.print("请输入存入的金额:");
Scanner money1=new Scanner(System.in);
float money=money1.nextFloat();
amount+=money;
message.put(name, amount);//把存取的金额存到哈希表中
System.out.printf("存款成功你的余额为:"+"%.2f",amount);
System.out.println();
}
else
System.out.println("用户密码不正确");
}
else
System.out.println("不存在该用户");
}
取款
public static void withdrawal() {//取款
System.out.print("请输入用户名:");
Scanner name1=new Scanner(System.in);
name=name1.nextLine();
System.out.print("请输入密码:");
Scanner passworld1=new Scanner(System.in);
passworld=passworld1.nextLine();
if(user.containsKey(name))
{
String mypassworld=user.get(name);
if(mypassworld.equals(passworld)) {
amount=message.get(name);
System.out.print("请输入取出的金额:");
Scanner money1=new Scanner(System.in);
float money=money1.nextFloat();
if(amount<money)
System.out.println("取款失败,余额不足");
else {
amount=amount-money;
message.put(name, amount);
System.out.printf("取款成功你的余额为:"+"%.2f",amount);
System.out.println();
}
}
else
System.out.println("用户密码不正确");
}
else
System.out.println("不存在该用户");
}
转账
public static void transfer() {//转账
System.out.print("请输入用户名:");
Scanner name1=new Scanner(System.in);
name=name1.nextLine();
System.out.print("请输入密码:");
Scanner passworld1=new Scanner(System.in);
passworld=passworld1.nextLine();
if(user.containsKey(name))
{
String mypassworld=user.get(name);
if(mypassworld.equals(passworld)) {
amount=message.get(name);
System.out.print("请输入转出的金额:");
Scanner money1=new Scanner(System.in);
float money=money1.nextFloat();
System.out.print("请输入要转入的账户:");
Scanner name2=new Scanner(System.in);
String name3=name2.nextLine();//要转入的账户
if(user.containsKey(name3)) {
if(amount<money) {
System.out.println("转账失败,余额不足");
}
else {
amount=amount-money;
message.put(name, amount);
message.put(name3, money);
System.out.printf("取款成功你的余额为:"+"%.2f",amount);
System.out.println();
}
}
else
System.out.println("要转入的账户不存在");
}
else
System.out.println("用户密码不正确");
}
else
System.out.println("不存在该用户");
}
ATM管理系统的更多相关文章
- ATM管理系统(三)
一.作业信息 博客班级 软件工程 作业要求 作业要求 作业目标 你理解的作业目标具体内容 学号 3180701218 二.题目要求 编写一个ATM管理系统,语言不限,要求应包括以下主要功能:(1)开户 ...
- 个人作业三——ATM管理系统
一 作业信息 博客班级 https://edu.cnblogs.com/campus/ahgc/AHPU-se-JSJ18/ 作业要求 https://edu.cnblogs.com/campus/a ...
- 软件工程作业--ATM自助银行服务系统
博客班级 AHPU软件工程 作业要求 ATM自助银行服务系统 作业目标 编码实现ATM自助银行服务系统 学号 3180701118 目录 一.作业要求 二.代码及运行界面 1.test类 2.User ...
- 从啥也不会到可以胜任最基本的JavaWeb工作,推荐给新人的学习路线(二)
在上一节中,主要阐述了JavaScript方面的学习路线.先列举一下我朋友的经历,他去过培训机构,说是4个月后月薪过万,虽然他现在还未达到这个指标. 培训机构一般的套路是这样:先教JavaSE,什么都 ...
- Sql Server——数据的增删改
所谓数据的增删改就是在创建好数据库和表后向表中添加数据.删除表中的数据.更改表中的一些数据. 新增数据: 语法一: insert into 表名 values (数据内容) --这里需要 ...
- Sql Server——数据增删改
所谓数据的增删改就是在创建好数据库和表后向表中添加数据.删除表中的数据.更改表中的一些数据. 新增数据: 语法一: insert into 表名 values (数据内容) --这里需要 ...
- python第二十四天-----作业终于完成啦
作业 1, ATM:模拟实现一个ATM + 购物商城程序 额度 15000或自定义实现购物商城,买东西加入 购物车,调用信用卡接口结账可以提现,手续费5%支持多账户登录支持账户间转账记录每月日常消费流 ...
- java第一节感受
第一节java课考试,感觉自从小学期和实习过了以后就等这个测试了,测试过了以后就是中秋节了,下周再上一节java又放国庆节了. 当时报软工的时候就早早地做好了心理准备,但是当亲身经历一遍后真的有了一种 ...
- 模拟实现ATM与购物商城
一.功能介绍(第6条未实现)模拟实现一个ATM + 购物商城程序1额度15000或自定义2实现购物商城,买东西加入购物车,调用信用卡接口结账3可以提现,手续费5%4支持多账户登录5支持账户间转账6记录 ...
随机推荐
- 小样本元学习综述:A Concise Review of Recent Few-shot Meta-learning Methods
原文链接 小样本学习与智能前沿 . 在这个公众号后台回复'CRR-FMM',即可获得电子资源. 1 Introduction In this short communication, we prese ...
- Python音视频开发:消除抖音短视频Logo和去电视台标
☞ ░ 前往老猿Python博文目录 ░ 一.引言 对于带Logo(如抖音Logo.电视台标)的视频,有三种方案进行Logo消除: 直接将对应区域用对应图像替换: 直接将对应区域模糊化: 通过变换将要 ...
- PyQt(Python+Qt)学习随笔:QMainWindow的addDockWidget方法增加QDockWidget停靠窗到主窗口
专栏:Python基础教程目录 专栏:使用PyQt开发图形界面Python应用 专栏:PyQt入门学习 老猿Python博文目录 DockWidget除了放在QMainWindow窗口内外,也可以放在 ...
- PyQt(Python+Qt)学习随笔:Qt Designer中部件的 baseSize和sizeIncrement
1.baseSize 部件的 baseSize是部件的基础大小(单位:像素),如果部件设定了sizeIncrement,该属性用于在调整部件尺寸时计算部件应该调整到的合适值,但这个属性缺省值是QSiz ...
- sqlite 数据库与mysql 数据库使用区别记录
遇到了就记点儿. 1.sqlite 中,设置外键关联,没啥用.只有mysql 中可用.
- 团队作业part4--项目冲刺
七天敏捷冲刺汇总 1. Day1 Scrum 冲刺博客 2. Day2 Scrum 冲刺博客 3. Day3 Scrum 冲刺博客 4. Day4 Scrum 冲刺博客 5. Day5 Scrum 冲 ...
- Codeforces Edu Round 53 A-D
A. Diverse Substring 找普遍性(特殊解即可). 最简单的便是存在一个区间\([i, i + 1] (1 <= i < n)\),且$str[i] $ $ != str[ ...
- 【学习笔记】K-D tree 区域查询时间复杂度简易证明
查询算法的流程 如果查询与当前结点的区域无交集,直接跳出. 如果查询将当前结点的区域包含,直接跳出并上传答案. 有交集但不包含,继续递归求解. K-D Tree 如何划分区域 可以借助下文图片理解. ...
- Acwing 393. 雇佣收银员
算法1: 差分约束 + 枚举 O(Tn2028) 由于牵扯到 \([i - 8 + 1, i]\) 这段区间的和的约束,所以用前缀和更好表达一些. 设 \(num[i]\)表示 \(i\) 时刻有多少 ...
- Java并发编程的艺术(十一)——Executor与线程池
Executor框架简介 从JDK5开始,把工作单元和执行机制分离开来了,工作的单元包括Runnable和Callable,执行机制就是由Executor框架提供. Executor两级调度模型 Ho ...