Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use nested loops to simulate ATM withdrawal operations in Java

Shulou Source: shulou.com Published: 2022-06-03 09:20:54 11月15日 Update

Editor to share with you how Java uses nested loops to simulate ATM withdrawal business operations, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

The details are as follows:

Package com.jredu.ch03;import java.util.Scanner;public class Work4 {public static void main (String [] args) {/ / TODO Auto-generated method stub Scanner scan = new Scanner (System.in); for (int I = 1; I

< 4; i++) { System.out.print("请输入密码:"); String pwd = scan.next(); if (!pwd.equals("111111")) { //密码错误 if(i==3){ System.out.println("密码错误,请取卡"); }else{ System.out.println("密码错误,还有"+(3-i)+"次机会"); } }else{ //密码正确 while(true){ System.out.print("请输入金额:"); int money = scan.nextInt(); if(money0==0&&money>

0&&money

Tags: Articles business loops content not much most more knowledge industry information information channels amount channels transactions references learning help input Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Tech Info MariaDB Shulou Information Shulou Technology