Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 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.        
  21.        
  22.         while (myAccount.getbalance() >= 0)
  23.         {
  24.                 boolean amountWithdrawn = myAccount.withdraw(100);
  25.                 myBills.deposit(amountWithdrawn);
  26.                 if(amountWithdrawn)
  27.                     break;
  28.                    
  29.         }
  30.        
  31.                
  32.         int totalMoney = myAccount.getbalance();
  33.         int totalBills = myBills.getbalance();
  34.            
  35.         System.out.println("then after paying his bills he is left with $" + totalMoney + " and the bank now has $" + totalBills + " of his money.");
  36.        
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement