Advertisement
Guest User

Untitled

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