checkbookmain.java

来自「Java程序设计技巧与开发实例附书源代码。」· Java 代码 · 共 38 行

JAVA
38
字号

public class CheckBookMain
{
   private static CheckBook checkBook = null;
   public static String showMenu()
   {
      System.out.println("\n\t\t to add a [C]heck");
      System.out.println("\t\t to add a [D]eposit");
      System.out.println("\t\t to [L]ist all transactions");
      System.out.println("\n\t\t to e[X]it program");
      System.out.print("\n\tYour choice: ");
      return Console.readString();
   }

   public static void main(String args[])
   {
      System.out.print("Starting balance: $");
      checkBook = new CheckBook(Console.readDouble());
      String choice = showMenu();
      while (!choice.equalsIgnoreCase("X"))
      {
         if (choice.equalsIgnoreCase("C"))
         {
            checkBook.add(new Check());
         }
         else if (choice.equalsIgnoreCase("D"))
         {
            checkBook.add(new Deposit());
         }
         else if (choice.equalsIgnoreCase("L"))
         {
            checkBook.list();
         }
         choice = showMenu();
      }
   }
}

⌨️ 快捷键说明

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