⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customerconsole.java

📁 模拟了atm机的基本功能
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   CustomerConsole.java

package atm.physical;

import banking.Money;
import simulation.Simulation;

public class CustomerConsole
{
    public static class Cancelled extends Exception
    {

        public Cancelled()
        {
            super("Cancelled by customer");
        }
    }


    public CustomerConsole()
    {
    }

    public void display(String s)
    {
        Simulation.getInstance().clearDisplay();
        Simulation.getInstance().display(s);
    }

    public int readPIN(String s)
        throws Cancelled
    {
        Simulation.getInstance().clearDisplay();
        Simulation.getInstance().display(s);
        Simulation.getInstance().display("");
        String s1 = Simulation.getInstance().readInput(1, 0);
        Simulation.getInstance().clearDisplay();
        if(s1 == null)
            throw new Cancelled();
        else
            return Integer.parseInt(s1);
    }

    public synchronized int readMenuChoice(String s, String as[])
        throws Cancelled
    {
        Simulation.getInstance().clearDisplay();
        Simulation.getInstance().display(s);
        for(int i = 0; i < as.length; i++)
            Simulation.getInstance().display((i + 1) + ") " + as[i]);

        String s1 = Simulation.getInstance().readInput(3, as.length);
        Simulation.getInstance().clearDisplay();
        if(s1 == null)
            throw new Cancelled();
        else
            return Integer.parseInt(s1) - 1;
    }

    public synchronized Money readAmount(String s)
        throws Cancelled
    {
        Simulation.getInstance().clearDisplay();
        Simulation.getInstance().display(s);
        Simulation.getInstance().display("");
        String s1 = Simulation.getInstance().readInput(2, 0);
        Simulation.getInstance().clearDisplay();
        if(s1 == null)
        {
            throw new Cancelled();
        } else
        {
            int i = Integer.parseInt(s1) / 100;
            int j = Integer.parseInt(s1) % 100;
            return new Money(i, j);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -