Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. /*Barbra Basiga 2010*/
  2.  
  3. import AG_Banks.*;
  4. import java.io.*;
  5.  
  6. public class AG_SadMan
  7. {
  8.     public static void main(String args[]) throws IOException
  9.     {
  10.         AG_Account myAccount, myBills;
  11.         System.out.println("How much money do you have?");
  12.         BufferedReader myReader = new BufferedReader (new InputStreamReader(System.in));
  13.         int amountOfMoney = Integer.parseInt(myReader.readLine());
  14.        
  15.         myAccount = new AG_Account(amountOfMoney);
  16.         myBills = new AG_Account();
  17.    
  18.         System.out.print("If Sad Man had $" + amountOfMoney + " in his account, ");
  19.        
  20.         amountWithdrawn=100;
  21.         boolean isOver=false;
  22.         while (myAccount.getbalance() >= 0  && !isOver)
  23.         {
  24.                  isOver = myAccount.withdraw(amountWithdrawn);
  25.                 if(isOver)
  26.                     amountWithdrawn=0;
  27.                 myBills.deposit(amountWithdrawn);
  28.                
  29.                    
  30.         }
  31.        
  32.                
  33.         int totalMoney = myAccount.getbalance();
  34.         int totalBills = myBills.getbalance();
  35.            
  36.         System.out.println("then after paying his bills he is left with $" + totalMoney + " and the bank now has $" + totalBills + " of his money.");
  37.        
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement