java 銀行存取款_用Java編寫銀行存錢取錢

const readline = require(‘readline-sync‘)//引用readline-sync

let s = 2;//錯誤的次數

for (let i = 0; i < 3; i++) {

console.log(‘請輸入名:(由英文組成)‘);

let user = readline.question();

console.log(‘請輸入密碼:(由數字組成)‘);

let password = readline.question();

let arr = [‘yang‘, ‘123456‘];

if (user == arr[0] && password == arr[1]) {

console.log(‘歡迎您,登陸成功‘);

for (let yewu = 1; yewu >= 1; yewu++) {

console.log(‘請選擇業務:\n1.存款: \n2.取款: \n3.查看: \n4.退出:‘);

let yewu = readline.question() - 0;

let money = 3000;

if (yewu > 4) {

console.log(‘對不起你輸入的有誤,請重新輸入:‘)

continue;

}

switch (yewu) {

case 1:

//存款money2為錢變化后的總數

console.log(‘存款‘);

console.log(‘請輸入存款金額:‘);

let cunkuan = readline.question() - 0;

money2 = money + cunkuan;

console.log(‘系統正在為你存錢請稍等。。。。。\n存錢成功您當前余額為‘ + money2);

continue;

case 2:

console.log(‘取款‘);

console.log(‘請輸入取款金額:‘);

let qukuan = readline.question() - 0;

if (qukuan > money2) {

console.log(‘對不起你的余額不足!,您的余額不足,請重新輸入或者退出‘);

} else {

money2 = money2 - qukuan;

console.log(‘當前余額為:‘ + money2);

}

continue;

case 3:

console.log(‘查看‘);

console.log(‘當前你的余額為:‘ + money2);

continue;

case 4:

console.log(‘退出‘);

console.log(‘歡迎你下次使用!‘);

break;

}break;

}

break;

} else {//輸入不正確時

if (s != 0) {

console.log(‘密碼或賬戶名錯誤,您還有‘ + s + "次機會,請重新輸入:");

s--;

continue;

} else {

console.log(‘對不起,賬戶已鎖定!‘);

break;

}

}

}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/392453.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/392453.shtml
英文地址,請注明出處:http://en.pswp.cn/news/392453.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

垃圾郵件分類 python_在python中創建SMS垃圾郵件分類器

垃圾郵件分類 python介紹 (Introduction) I have always been fascinated with Google’s gmail spam detection system, where it is able to seemingly effortlessly judge whether incoming emails are spam and therefore not worthy of our limited attention.我一直對Goo…

leetcode 103. 二叉樹的鋸齒形層序遍歷(層序遍歷)

給定一個二叉樹&#xff0c;返回其節點值的鋸齒形層序遍歷。&#xff08;即先從左往右&#xff0c;再從右往左進行下一層遍歷&#xff0c;以此類推&#xff0c;層與層之間交替進行&#xff09;。例如&#xff1a; 給定二叉樹 [3,9,20,null,null,15,7],3/ \9 20/ \15 7 返回…

簡單易用的MongoDB

從我第一次聽到Nosql這個概念到如今已經走過4個年頭了&#xff0c;但仍然沒有具體的去做過相應的實踐。最近獲得一段學習休息時間&#xff0c;購買了Nosql技術實踐一書&#xff0c;正在慢慢的學習。在主流觀點中&#xff0c;Nosql大體分為4類&#xff0c;鍵值存儲數據庫&#x…

html畫布圖片不顯示_如何在HTML5畫布上顯示圖像

html畫布圖片不顯示by Nash Vail由Nash Vail Ok, so here’s a question: “Why do we need an article for this, Nash?”好的&#xff0c;這是一個問題&#xff1a;“為什么我們需要為此寫一篇文章&#xff0c;納什&#xff1f;” Well, grab a seat.好吧&#xff0c;坐下…

java斷點續傳插件_視頻斷點續傳+java視頻

之前仿造uploadify寫了一個HTML5版的文件上傳插件&#xff0c;沒看過的朋友可以點此先看一下~得到了不少朋友的好評&#xff0c;我自己也用在了項目中&#xff0c;不論是用戶頭像上傳&#xff0c;還是各種媒體文件的上傳&#xff0c;以及各種個性的業務需求&#xff0c;都能得到…

全棧入門_啟動數據棧入門包(2020)

全棧入門I advise a lot of people on how to build out their data stack, from tiny startups to enterprise companies that are moving to the cloud or from legacy solutions. There are many choices out there, and navigating them all can be tricky. Here’s a brea…

Go-json解碼到接口及根據鍵獲取值

Go-json解碼到接口及根據鍵獲取值 package mainimport ("encoding/json""fmt""github.com/bitly/go-simplejson" )type JsonServer struct {ServerName stringServerIP string }type JsonServers struct {Servers []JsonServer }func main() {…

C#接口的顯隱實現

顯示接口實現與隱式接口實現 何為顯式接口實現、隱式接口實現&#xff1f;簡單概括&#xff0c;使用接口名作為方法名的前綴&#xff0c;這稱為“顯式接口實現”&#xff1b;傳統的實現方式&#xff0c;稱為“隱式接口實現”。下面給個例子。 IChineseGreeting接口&#xff0c;…

亞馬遜 各國站點 鏈接_使用Amazon S3和HTTPS的簡單站點托管

亞馬遜 各國站點 鏈接by Georgia Nola喬治亞諾拉(Georgia Nola) 使用Amazon S3和HTTPS的簡單站點托管 (Simple site hosting with Amazon S3 and HTTPS) Hiya folks!大家好&#xff01; In this tutorial I’ll show you how to host a static website with HTTPS on AWS wit…

leetcode 387. 字符串中的第一個唯一字符(hash)

給定一個字符串&#xff0c;找到它的第一個不重復的字符&#xff0c;并返回它的索引。如果不存在&#xff0c;則返回 -1。 示例&#xff1a; s “leetcode” 返回 0 s “loveleetcode” 返回 2 class Solution { public int firstUniqChar(String s) { int[][] tempnew i…

marlin 三角洲_三角洲湖泊和數據湖泊-入門

marlin 三角洲Data lakes are becoming adopted in more and more companies seeking for efficient storage of their assets. The theory behind it is quite simple, in contrast to the industry standard data warehouse. To conclude this this post explains the logica…

tomcat中設置Java 客戶端程序的http(https)訪問代理

1、假定http/https代理服務器為 127.0.0.1 端口為8118 2、在tomcat/bin/catalina.sh腳本文件中設置JAVA_OPTS&#xff0c;如下圖&#xff1a; 保存后重啟tomcat就能生效。轉載于:https://www.cnblogs.com/zhangmingcheng/p/11211776.html

java界面中顯示圖片_java中怎樣在界面中顯示圖片?

方法一&#xff1a;JLabel helloLabel new JLabel("New label");helloLabel.setIcon(new ImageIcon("E:\\javaSE\u4EE3\u7801\\TimeManager\\asset\\hello.gif"));helloLabel.setBackground(Color.BLACK);helloLabel.setBounds(0, 0, 105, 50);contentPan…

one-of-k 編碼算法_我們如何教K-12學生如何編碼

one-of-k 編碼算法by Christopher George克里斯托弗喬治(Christopher George) 我們如何教K-12學生如何編碼 (How we’re teaching K-12 students how to code) Hello World! (Sorry, I couldn’t resist.) My name is Christopher George and I am currently a Junior at Carn…

knime簡介_KNIME簡介

knime簡介Data Science is abounding. It considers different realms of the data world including its preparation, cleaning, modeling, and whatnot. To be precise, it is massive in terms of the span it covers and the opportunities it offers. Needless to say, th…

hadoop2.x HDFS快照介紹

說明&#xff1a;由于近期正好在研究hadoop的快照機制。看官網上的文檔講的非常仔細。就順手翻譯了。也沒有去深究一些名詞的標準譯法&#xff0c;所以可能有些翻譯和使用方法不是非常正確&#xff0c;莫要介意~~ 原文地址&#xff1a;&#xff08;Apache hadoop的官方文檔&…

MQTT服務器搭建--Mosquitto用戶名密碼配置

前言&#xff1a; 基于Mosquitto服務器已經搭建成功&#xff0c;大部分都是采用默認的是允許匿名用戶登錄模式&#xff0c;正式上線的系統需要進行用戶認證。 1.用戶參數說明 Mosquitto服務器的配置文件為/etc/mosquitto/mosquitto.conf&#xff0c;關于用戶認證的方式和讀取的…

java number string_java基礎系列(一):Number,Character和String類及操作

這篇文章總結了Java中最基礎的類以及常用的方法&#xff0c;主要有&#xff1a;Number&#xff0c;Character&#xff0c;String。1、Number類在實際開發的過程中&#xff0c;常常會用到需要使用對象而不是內置的數據類型的情形。所以&#xff0c;java語言為每個內置數據類型都…

誰參加了JavaScript 2018狀況調查?

by Sacha Greif由Sacha Greif 誰參加了JavaScript 2018狀況調查&#xff1f; (Who Took the State of JavaScript 2018 Survey?) 我們如何努力使調查更具代表性 (How we’re working to make the survey more representative) I was recently listening to a podcast episode…

機器學習 建立模型_建立生產的機器學習系統

機器學習 建立模型When businesses plan to start incorporating machine learning to enhance their solutions, they more often than not think that it is mostly about algorithms and analytics. Most of the blogs/training on the matter also only talk about taking …