// ********************************************* // 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 withdraw, double withdraw ) { balance = balance - withdraw; {// Do the IF if (withdraw <= balance) System.out.print("Take less, Dumbass?"); }//end if, do else { else do stuff to get new balance } } // end withdraw // The "Print Me" method: void printMe() { System.out.println("Your Current Name: " + name ); // prints user's name. System.out.println("We'll find your crap at: " + address); System.out.println("Your social: " + social ); System.out.println("Your Account Details: " + "\n\n"); System.out.println("Type of Account: " + accountType); // prints type of account. System.out.println("Year Opened: " + yearOpened); // prints the year the account was opened. System.out.println("Current Interest Rate: " + interestRate); // prints interest rate. System.out.println("Current Balance: " + balance); // prints current balance. System.out.println("Current ammount of dumbass protection: " + draftLimit); System.out.print(""); } }