SHARE
TWEET

Untitled

a guest Nov 9th, 2019 110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class TestAccount {
  4.  
  5.     public static void main(String[] args) {
  6.         String name, name1, name2, name3;
  7.         double balance;
  8.         long acctNum;
  9.         Account acct, acct2, acct3;
  10.        
  11.  
  12.         Scanner scan = new Scanner(System.in);
  13.            
  14.                
  15.         System.out.println("Enter account holder's first name");
  16.         name = scan.next();
  17.        
  18.        
  19.         acct = new Account(name);
  20.         System.out.println("Account for: " + name);
  21.         System.out.println(acct);
  22.         System.out.println("\nEnter initial balance");
  23.         balance = scan.nextLong();
  24.        
  25.         acct = new Account(balance,name);
  26.         System.out.println("Account for " + name + ":");
  27.         System.out.println(acct);
  28.         System.out.println("\nEnter account number");
  29.         acctNum = scan.nextLong();
  30.    
  31.         acct = new Account(balance,name,acctNum);
  32.         System.out.println("Account for " + name + ":");
  33.         System.out.println(acct);
  34.         System.out.print("\nDepositing 300 into account \nbalance is now $");
  35.         //deposit
  36.         acct.deposit(300);
  37.         System.out.println(acct.getBalance());
  38.         System.out.print("\nWithdrawing -$70, \nbalance is now ");
  39.         //Withdrawal
  40.         acct.withdraw(70);
  41.         System.out.println(acct.getBalance());
  42.         System.out.print("\nWithdrawing -$25 with a $2.75 fee, \nbalance is now ");
  43.         //Withdrawal w/ fee
  44.         acct.withdraw(25,2.75);
  45.         System.out.println(acct.getBalance());
  46.         //toString
  47.         System.out.println("");
  48.         System.out.println(acct.toString());
  49.         //adding interest .035%
  50.         System.out.println("\nYour .035% annual interest on $302.25 is:");
  51.         acct.addInterest(302.25,.035);
  52.         System.out.println(acct + " In Annual Interest");
  53.         //CLOSE
  54.         System.out.println("");
  55.         Account.close(acct);
  56.         System.out.println(acct);
  57.                
  58.            
  59.         //JOIN ACCT
  60.        
  61.         System.out.println("Enter name one: ");
  62.         name1 = scan.nextLine();
  63.         acct = new Account(100,name);
  64.         System.out.println(acct);
  65.        
  66.        
  67.         System.out.println("Enter name two: ");
  68.         name2 = scan.nextLine();
  69.         acct2 = new Account(101,name2);
  70.         System.out.println(acct2);
  71.        
  72.        
  73.         System.out.println("acct1   *"+ acct +"\nacct2   *"+ acct2 );
  74.        
  75.        
  76.         name3 = name + name2;
  77.         acct3 = new Account(name3);
  78.        // acct3 = acct3.AccountConsolidate(acct, acct2);
  79.         acct3.getAcctNumber();
  80.         acct3 = Account.consolidate(acct, acct2);
  81.    
  82.        // System.out.println(acct3.getBalance());
  83.         System.out.println("when i run acct3 = new Account(name3) is shold generate a account                    
  84.         number but it doesnt.. or maybe when i run .getAcctNumber but it returns 0");
  85.         System.out.println(acct3.getAcctNumber());
  86.         System.out.println("\nacct3   *" + acct3);
  87.        
  88.        
  89.         System.out.println("\n closing acct & acct2");
  90.         Account.close(acct);
  91.         Account.close(acct2);
  92.        
  93.         System.out.println(acct);
  94.         System.out.println(acct2);
  95.        
  96.         System.out.println("\n" + name + "&"+  name2 + " Joined Account:" + acct3);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top