一、题目要求

编写一个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. Plant Leaves Classification植物叶子分类:基于孪生网络的小样本学习方法

    目录 Abstract Introduction PROPOSED CNN STRUCTURE INITIAL CNN ANALYSIS EXPERIMENTAL STRUCTURE AND ALGO ...

  2. 九. Vuex详解

    1. 理解Vuex 1.1 Vuex功能 官方解释 Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式.它采用 集中式存储 管理应用的所有组件的状态,并以相应的规则保证状态以一种可预测的方 ...

  3. PyQt(Python+Qt)学习随笔:窗口部件大小策略sizePolicy与SizeConstraint布局大小约束的关系

    在<PyQt(Python+Qt)学习随笔:Qt Designer中部件的三个属性sizeHint缺省尺寸.minimumSizeHint建议最小尺寸和minimumSize最小尺寸>. ...

  4. Mac下安装Mesa

    下载Mesa源代码: git clone https://gitlab.freedesktop.org/mesa/mesa.git 如果下载太慢,请参看 下载国外资源. 我下载后看到的Mesa版本信息 ...

  5. msfvenom命令自动补全工具下载=>msfvenom-zsh-completion

    msfvenom参数和命令很多,各种payload和encoder经常让⼈眼花缭乱,特别是对英语不好的⼈来说有些命令可能很容易忘记. 所以 Green_m 开发了⼀个zsh插件,可以⾃动化的补全msf ...

  6. 本地代码上传到github

    一,注册Github账号 1.先注册一个账号,注册地址:https://github.com/ 2.登录后,点击start a project 3.创建一个repository name,输入框随便取 ...

  7. 读github,deepfm,pytorch源码 记录

    代码:https://github.com/chenxijun1029/DeepFM_with_PyTorch 2020/12/2首先是数据预处理文件:dataPreprocess.py1. 源数据集 ...

  8. .net core 注入的几种方式

    一.注册的几种类型: services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();//单利模式,整个应用程序 ...

  9. Boost UDP Transaction Performance

    提高UDP交互性能 这是一篇个人认为非常非常厉害的文章,取自这里.讲述了如何提升UDP流的处理速率,但实际涉及的技术点不仅仅限于UDP.这篇文章中涉及的技术正好可以把前段时间了解的知识串联起来.作者: ...

  10. 算法——寻找第K个最大的数

    在未排序的数组中找到第 k 个最大的元素. 链接: leetcode. 解题思路:通过快速排序的思想方法,每次随机获取指定范围内一个树的排序位置,然后根据这个位置,再重新指定范围,直到这个位置索引满足 ...