// ********************************************* // Lab 2 -- Bank Account Dos Class Wednesday 8 October, 2003 // Krstofer Evans, 10speed@ureach.com // CSCI 15A, Section 08 //*********************************************** public class bankAccountDos { // Import ConsoleReader ConsoleReader Console = new ConsoleReader(System.in); // Class variables private String name = null; // account holder's name. private String social = null; // Social Security Number. private String accountType = null; // type of account. private double balance = 0; // The balance for the account. private double interestRate = 0; // Interest Rate. private int yearOpened = 2003; // The year the account was opened. private String address = null; private double deposit = 0; private double withdraw = 0; private double draftLimit = 0; // The Constructors. public bankAccountDos (double aBalance, String aName) {name = aName; balance = aBalance;} public bankAccountDos (String aName, String aSocial, String aAccountType, double aBalance, double aInterestRate, int aYearOpened) {name = aName; social = aSocial; accountType = aAccountType; balance = aBalance; interestRate = aInterestRate; yearOpened = aYearOpened;} public bankAccountDos() {} public bankAccountDos (String aName, String aSocial, String aAccountType, double aBalance, double aInterestRate, int aYearOpened, double aDraftLimit, String aAddress) {name = aName; social = aSocial; accountType = aAccountType; balance = aBalance; interestRate = aInterestRate; yearOpened = aYearOpened; draftLimit = aDraftLimit; address = aAddress;} // Getter methods. public String getName() {return name;} public String getSocial() {return social;} public String getAccountType() {return accountType;} public double getBalance() {return balance;} public double getInterestRate() {return interestRate;} public int getYearOpened() {return yearOpened;} public double getWithdraw() {return withdraw;} public double getDeposit() {return deposit;} public double getDraftLimit() {return draftLimit;} public String getAddress() {return address;} // Setter methods. public void setName(String newName) {name = newName;} public void setSocial(String newSocial) {social = newSocial;} public void setAccountType(String newAccountType) {accountType = newAccountType;} public void setBalance(double newBalance) {balance = newBalance;} public void setInterestRate(double aInterestRate) {interestRate = aInterestRate;} public void setYearOpened(int aYearOpened) {yearOpened = aYearOpened;} public void setDraftLimit(double aDraftLimit) {draftLimit = aDraftLimit;} public void setAddress(String aAddress) {address = aAddress;} // The "Deposit" method: public double deposit(double deposit ) { balance = balance + deposit; return balance; } // The "Withdraw" method: public double withdraw( double deposit, double withdraw, String input) { ConsoleReader console = new ConsoleReader(System.in); balance = balance - withdraw; // Do the IF if (withdraw <= balance) System.out.println("Take less, Dumbass."); /* 1 */System.out.println("To withdraw all $$ from your account, please press one."); /* 2 */System.out.println("Or, since you have Overdraft Protection in the ammount of 200$, you may remove up to" + withdraw + 199 + "dollars from your account. To do so, please press two."); /* 3 */System.out.println("To quit, and Take That Girl Home now, please press three."); input = console.readLine(); { if (input.equals("1")); { System.out.println("Withdrawing" + balance + "from your account"); } elseif (input.equals("2")); { System.out.println("You may have up to" + balance + 199 + "dollars. How much money would you like?"); withdraw = console.readDouble(); if (withdraw <= balance + 199); { System.out.println("Withdrawing" + balance + withdraw + "from your account"); } elseif (System.out.println("You must fill out a loan application for that ammount.")); } elseif (input.equals("3")); { exit(0); } } // end withdraw // The Accrued balance Method public double calculateAccruedBalance() { double temp = balance; for(int i = 0; i