一、题目要求

编写一个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. Docsify+腾讯云对象存储 COS,一键搭建云上静态博客

    最近一直在想如何利用 COS 简化静态博客的搭建过程.搜了很多的静态博客搭建过程,发现大部分的静态博客都要通过编译才能生成静态页面.功夫不负有心人,终于让我找到了一个超简洁博客的搭建方法. 效果预览 ...

  2. Java 生成有序 UUID

    UUID.randomUUID() 生成的 UUID 是无序的,如果作为数据主键,不利于索引 Hibernate 的 UUIDHexGenerator.generate() 方法可以生成有序的 UUI ...

  3. 大厂是如何用DevCloud流水线实现自动化部署Web应用的?

    DevUI是一支兼具设计视角和工程视角的团队,服务于华为云DevCloud平台和华为内部数个中后台系统,服务于设计师和前端工程师. 官方网站:devui.design Ng组件库:ng-devui(欢 ...

  4. CentOS下Mysql的操作

    重启Mysql的各种方法 1.通过rpm包安装的MySQL service mysqld restart /etc/inint.d/mysqld start 2.从源码包安装的MySQL // lin ...

  5. 第7.24节 Python案例详解:使用property函数定义属性简化属性访问代码实现

    第7.24节 Python案例详解:使用property函数定义属性简化属性访问代码实现 一.    案例说明 本节将通过一个案例介绍怎么使用property定义快捷的属性访问.案例中使用Rectan ...

  6. Google浏览器PostMan插件版安装步骤

    PostMan插件版安装步骤: 第一步:把下载后的.crx扩展名的离线Chrome插件的文件扩展名改成.zip或者.rar 第二步:右键点击该文件,并使用压缩软件(如winrar.360压缩等)对该压 ...

  7. python xlsxwriter创建excel 之('Exception caught in workbook destructor. Explicit close() may be required for workbook.',)

    python2.7使用xlsxwriter创建excel ,不关闭xlsxwriter对象,会报错: Exception Exception: Exception('Exception caught ...

  8. js- 实现属性名的拼接 obj['name']

     obj.name---->obj[name] 这两种调用方式一样,使用obj.name内部转换成 obj['name'], 使用obj['name']更快. obj['name'] 里面必须是 ...

  9. vue中监视对象内部变化的三种方法

    一,对整个对象监视 watch:{ obj:{ handler(newV,oldV){ console.log('obj changed') }, deep: true,//深度遍历 immediat ...

  10. 【题解】「CF1373B」01 Game

    这题好水,就是简单的模拟+字符串. \(\sf Translation\) 给定一个 \(01\) 串,如果 \(0\) 出现的次数和 \(1\) 出现的次数的最小值是奇数,输出 DA ,否则输出 N ...