// ********************************************* // Lab 2 -- Bank Account Test Class Wednesday 8 October, 2003 // Krstofer Evans, 10speed@ureach.com // CSCI 15A, Section 08 //*********************************************** public class BAT { public static void main(String[] args) { String name; String type; String social; int yearOpened; double interestRate; String accountType; double deposit; double withdraw; double balance; ConsoleReader console = new ConsoleReader(System.in); System.out.println("What is your name?"); name = console.readLine(); System.out.println("How much money would you like in your checking account?"); balance = console.readDouble(); bankAccount checking = new bankAccount(balance, name); System.out.println("Please enter your social in xxx-xx-xxxx form."); social = console.readLine(); checking.setSocial(social); System.out.println("What would you like to name this account?"); accountType = console.readLine(); checking.setAccountType(accountType); checking.setBalance(balance); System.out.println("The 4 digit year your account was opened?"); yearOpened = console.readInt(); checking.setYearOpened(yearOpened); System.out.println("Please invent an interest rate."); interestRate = console.readDouble(); checking.setInterestRate(interestRate); // Print checking info: System.out.print("Current bank account is: "); System.out.println(checking.getAccountType()); System.out.print("Yor say your name is: "); System.out.println(checking.getName()); System.out.print("You say your social is: "); System.out.println(checking.getSocial()); System.out.print("Your current balance is: "); System.out.println(checking.getBalance()); System.out.print("You opened your account in: "); System.out.println(checking.getYearOpened()); System.out.print("You say your interest rate is: "); System.out.println(checking.getInterestRate()); System.out.println(""); System.out.println(""); // Get savings Info: System.out.print("Let's do savings now, shall we?"); System.out.println(""); System.out.println(""); System.out.println("What is your name?"); name = console.readLine(); System.out.println("Your social, in xxx-xxx-xxxx form?"); social = console.readLine(); System.out.println("And the name for this account is?"); accountType = console.readLine(); System.out.println("How much money would you like?"); balance = console.readDouble(); System.out.println("The 4 digit year your account was opened?"); yearOpened = console.readInt(); System.out.println("Please invent an interest rate."); interestRate = console.readDouble(); bankAccount savings = new bankAccount(name, social, accountType, balance, interestRate, yearOpened); savings.printMe(); // checking deposit / withdraw System.out.println("Please deposit some money into checking."); deposit = console.readDouble(); checking.deposit(deposit); System.out.print("Current checking balance after deposit: "); System.out.println(checking.getBalance()); System.out.println("Please make a withdraw from checking."); withdraw = console.readDouble(); checking.withdraw(withdraw); System.out.print("Current checking balance after withdraw: "); System.out.println(checking.getBalance()); System.out.print(""); // Savings deposit / withdraw System.out.println("Please deposit some money into savings."); deposit = console.readDouble(); savings.deposit(deposit); System.out.print("Current savings balance after deposit: "); savings.getBalance(); System.out.println(savings.getBalance()); System.out.println("Please make a withdraw from savings."); withdraw = console.readDouble(); savings.withdraw(withdraw); System.out.print("Current savings balance after withdraw: "); System.out.println(savings.getBalance()); } }