Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. public class BankingDriver { //The name of the class
  2.  
  3. public static void main (String [] args){ //First thing the pc looks at
  4. Banking nicksAcct = new Banking("Nick", 450, 500); //Creates the nicksAcct Object
  5. Banking carolsAcct = new Banking("Carol", 600, 700); //Creates the carolsAcct Object
  6. System.out.println(nicksAcct.getTotalMoney() + carolsAcct.getTotalMoney()); //Adds both of the accounts together and prints them on 1 line
  7. nicksAcct.setCheckMoney(nicksAcct.getCheckMoney + 100); //Calls for the total amount in Nicks Checking and adds on 100 dollars
  8. System.out.println(nicksAcct); //Prints nicks account
  9. Banking tempMoney = new Banking ("Temp", 0, 0); //Creates an intermediate variable
  10. tempMoney.setCheckMoney(nicksAcct.getCheckmoney + nicksAcct.getSaveMoney); //Moves all of the money from nick to temp check account
  11. nicksAcct.setCheckMoney(0); //sets nicks check money to 0
  12. nicksAcct.setSaveMoney(0); //sets nicks save money to 0
  13. carolsAcct.setSaveMoney(tempMoney.getCheckMoney + carolsAcct.getSaveMoney); //moves all the money to carols existing saving acount
  14. tempMoney.setCheckMoney(0); //sets check money to 0
  15. System.out.println(nicksAcct.getTotalMoney()); //prints out nicks account information
  16. System.out.println(carolsAcct.getTotalMoney()); //prints out carols account information
  17.  
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement