一、题目要求

编写一个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管理系统的更多相关文章

  1. ATM管理系统(三)

    一.作业信息 博客班级 软件工程 作业要求 作业要求 作业目标 你理解的作业目标具体内容 学号 3180701218 二.题目要求 编写一个ATM管理系统,语言不限,要求应包括以下主要功能:(1)开户 ...

  2. 个人作业三——ATM管理系统

    一 作业信息 博客班级 https://edu.cnblogs.com/campus/ahgc/AHPU-se-JSJ18/ 作业要求 https://edu.cnblogs.com/campus/a ...

  3. 软件工程作业--ATM自助银行服务系统

    博客班级 AHPU软件工程 作业要求 ATM自助银行服务系统 作业目标 编码实现ATM自助银行服务系统 学号 3180701118 目录 一.作业要求 二.代码及运行界面 1.test类 2.User ...

  4. 从啥也不会到可以胜任最基本的JavaWeb工作,推荐给新人的学习路线(二)

    在上一节中,主要阐述了JavaScript方面的学习路线.先列举一下我朋友的经历,他去过培训机构,说是4个月后月薪过万,虽然他现在还未达到这个指标. 培训机构一般的套路是这样:先教JavaSE,什么都 ...

  5. Sql Server——数据的增删改

    所谓数据的增删改就是在创建好数据库和表后向表中添加数据.删除表中的数据.更改表中的一些数据. 新增数据: 语法一: insert into 表名 values (数据内容)        --这里需要 ...

  6. Sql Server——数据增删改

    所谓数据的增删改就是在创建好数据库和表后向表中添加数据.删除表中的数据.更改表中的一些数据. 新增数据: 语法一: insert into 表名 values (数据内容)        --这里需要 ...

  7. python第二十四天-----作业终于完成啦

    作业 1, ATM:模拟实现一个ATM + 购物商城程序 额度 15000或自定义实现购物商城,买东西加入 购物车,调用信用卡接口结账可以提现,手续费5%支持多账户登录支持账户间转账记录每月日常消费流 ...

  8. java第一节感受

    第一节java课考试,感觉自从小学期和实习过了以后就等这个测试了,测试过了以后就是中秋节了,下周再上一节java又放国庆节了. 当时报软工的时候就早早地做好了心理准备,但是当亲身经历一遍后真的有了一种 ...

  9. 模拟实现ATM与购物商城

    一.功能介绍(第6条未实现)模拟实现一个ATM + 购物商城程序1额度15000或自定义2实现购物商城,买东西加入购物车,调用信用卡接口结账3可以提现,手续费5%4支持多账户登录5支持账户间转账6记录 ...

随机推荐

  1. AWD不死马与克制方法

    一个简单的不死马如: <?php ignore_user_abort(true); set_time_limit(0); unlink(__FILE__); $file = '.3.php'; ...

  2. 二分查找——没有想象中的容易(详解各种变式,超深度理解,c++)

    int binarySearch(int[] nums, int target) { int left = 0; int right = nums.length - 1; // 注意 while(le ...

  3. 精品工具【音乐下载器(可下载VIP音乐)】

    工具信息 更新时间:2020年5月26日00点07分更新内容:1. 增加快捷键2. 细分下载列表清除功能一款可以下载付费音乐的音乐下载器 下载链接:https://nitian1207.lanzous ...

  4. 补:冲刺Day1

    各个成员在 Alpha 阶段认领的任务: 任务 执行人 用户模块 高嘉淳 订单模块 覃泽泰 商品模块 莫政.卢耀恒 充值模块 卢耀恒 前端界面设计&代码 许梓莹.梁小燕 发布博客 莫政 明日各 ...

  5. 【自用】Notice

    读题 不要把 \(\sum a \oplus b\) 看成异或和. 注意读完整,有可能对原有符号有新的约定,不要想当然. 注意模数的 0 数清楚. 卡常&时间 打题之前一般先搞个自己的缺省源. ...

  6. 用Ubuntu和树莓派系统部署kubernetes集群后的一些心得

    方案 环境 操作系统:Ubuntu 16.04 & Raspbian GNU/Linux 9(Stretch Desktop) kubernetes :1.15.3 flannel:0.11. ...

  7. 我的js公共函数合集

    export default {     isDefin: function(value) { //数据是否被定义         if (value == null || value == &quo ...

  8. 简单的一段css代码让全站变灰,网站哀悼代码

    为表达全国各族人民对抗击新冠肺炎疫情斗争牺牲烈士和逝世通报的深切哀悼,国务院今天发布公告,决定2020年4月4日举行全国性哀悼活动.在此期间,全国和驻外使馆下半旗致哀,全国停止公共娱乐活动,4月4日1 ...

  9. 前端面试题CSS-div宽度设置为100%,设置属性margin-left和margin-right时出现的问题

    前端面试题CSS-div宽度设置为100%,设置属性margin-left和margin-right时出现的问题 div格式如下 <div class="a"> < ...

  10. Spring源码分析之AOP从解析到调用

    正文: 在上一篇,我们对IOC核心部分流程已经分析完毕,相信小伙伴们有所收获,从这一篇开始,我们将会踏上新的旅程,即Spring的另一核心:AOP! 首先,为了让大家能更有效的理解AOP,先带大家过一 ...