aznishboy

CheckingTest

Feb 9th, 2012
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.68 KB | None | 0 0
  1. import chn.util.*;
  2.  
  3. public class CheckingTester {
  4.    
  5.     public static void main(String[] args) {
  6.         System.out.println("ErrorFreeChecking Test");
  7.         System.out.println();
  8.         ConsoleIO input = new ConsoleIO();
  9.         CheckingAccount errorFree = new CheckingAccount();
  10.         boolean initial = false;
  11.         do{
  12.             try{
  13.                 System.out.print("Please enter the starting balance --> ");
  14.                 errorFree = new CheckingAccount(input.readDouble());
  15.                 System.out.println("Account opened with balance of " + errorFree.getBalance());
  16.                 System.out.println();
  17.                 initial = true;
  18.             }
  19.             catch (IllegalArgumentException e){
  20.                 System.out.println(e.getMessage());
  21.                 System.out.println();
  22.             }
  23.         }
  24.         while(initial == false);
  25.         boolean deposit = false;
  26.         do{
  27.             try{
  28.                 System.out.print("Please enter the amount to deposit --> ");
  29.                 errorFree.deposit(input.readDouble());
  30.                 System.out.println("Deposit made. Current account balance = " + errorFree.getBalance());
  31.                 System.out.println();
  32.                 deposit = true;
  33.             }
  34.             catch (IllegalArgumentException e){
  35.                 System.out.println(e.getMessage());
  36.                 System.out.println();
  37.             }
  38.         }
  39.         while(deposit == false);
  40.         boolean withdraw = false;
  41.         do{
  42.             try{
  43.                 System.out.print("Please enter the amount to withdrawl --> ");
  44.                 errorFree.withdraw(input.readDouble());
  45.                 System.out.println("Withdrawal made. Current account balance = " + errorFree.getBalance());
  46.                 System.out.println();
  47.                 withdraw = true;
  48.             }
  49.             catch (IllegalArgumentException e){
  50.                 System.out.println(e.getMessage());
  51.                 System.out.println();
  52.             }
  53.         }
  54.         while(withdraw == false);
  55.         System.out.println("Thank you for using ErrorFreeChecking...goodbye!");    
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment