Question: For the following, you will need these two codes. Do NOT make any changes to them when inputting them into your own code. public enum
For the following, you will need these two codes. Do NOT make any changes to them when inputting them into your own code.
public enum AccountType {Checking, Savings, CD, MoneyMarket, IRA}and
public class BankAccount { private int accountNumber; private double balance; private double interestRate; private String holderFirstName; private String holderLastName; private AccountType type; private static int nextAccountNum = 1001; public BankAccount() { accountNumber = getNextAccountNum(); balance = 0.0; interestRate = 0.0; holderFirstName = ""; holderLastName = ""; type = AccountType.Checking; } public BankAccount(String first, String last, double rate, AccountType at) { accountNumber = getNextAccountNum(); balance = 0.0; interestRate = rate; holderFirstName = first; holderLastName = last; type = at; } private int getNextAccountNum() { return nextAccountNum++; } public int getAccountNum() { return accountNumber; } public double checkBalance() { return balance; } public void deposit(double amount) { balance += amount; } public boolean withdraw(double amount) { boolean success = true; if((balance - amount) >= 0.0) // Only able to withdraw if there is actually enough money. { balance -= amount; } else { success = false; } return success; } public double getRate() { return interestRate; } public void setRate(double rate) { interestRate = rate; } public void applyInterest() { balance += (balance * (interestRate / 100)); } public String getHolderFullName() { return holderFirstName + " " + holderLastName; } public AccountType getType() { return type; } }
Question/Assignment:











End of Question/Assignment
3. Create a new class called BankPatron. 4. Give BankPatron the following private instance variables. a. First Name b. Last Name 3. Create a new class called BankPatron. 4. Give BankPatron the following private instance variables. a. First Name b. Last Name
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
