Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import chn.util.*;
- public class CheckingTester {
- public static void main(String[] args) {
- System.out.println("ErrorFreeChecking Test");
- System.out.println();
- ConsoleIO input = new ConsoleIO();
- CheckingAccount errorFree = new CheckingAccount();
- boolean initial = false;
- do{
- try{
- System.out.print("Please enter the starting balance --> ");
- errorFree = new CheckingAccount(input.readDouble());
- System.out.println("Account opened with balance of " + errorFree.getBalance());
- System.out.println();
- initial = true;
- }
- catch (IllegalArgumentException e){
- System.out.println(e.getMessage());
- System.out.println();
- }
- }
- while(initial == false);
- boolean deposit = false;
- do{
- try{
- System.out.print("Please enter the amount to deposit --> ");
- errorFree.deposit(input.readDouble());
- System.out.println("Deposit made. Current account balance = " + errorFree.getBalance());
- System.out.println();
- deposit = true;
- }
- catch (IllegalArgumentException e){
- System.out.println(e.getMessage());
- System.out.println();
- }
- }
- while(deposit == false);
- boolean withdraw = false;
- do{
- try{
- System.out.print("Please enter the amount to withdrawl --> ");
- errorFree.withdraw(input.readDouble());
- System.out.println("Withdrawal made. Current account balance = " + errorFree.getBalance());
- System.out.println();
- withdraw = true;
- }
- catch (IllegalArgumentException e){
- System.out.println(e.getMessage());
- System.out.println();
- }
- }
- while(withdraw == false);
- System.out.println("Thank you for using ErrorFreeChecking...goodbye!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment