Question: Java Programming Assignment: Create a program that models the operations of a bank. Each bank account has one owner or accountholder.The Bank has two types

Java Programming Assignment:

Create a program that models the operations of a bank. Each bank account has one owner or accountholder.The Bank has two types of account owners: a college student and a non college student(individual ) . It also offers three types of accounts a regular account type for non students, a college student account type, and a wealthy account type for anyone with a high balance. A college student and wealthy account type do not have monthly fees, however a non college student account type does have a monthly fee. Also, all accounts have a 2% interest rate. However, interest is added twice to a wealthy account type. In essence, all account types are basically the same except college student and wealthy accounts are not charged a monthly fee and when interest is added to a wealthy account type it is added twice. A lot of the program is already done and a Skeleton of the code has been provided please finish it and also follow the instruction of the comments in the code. Do not change the names of any of the classes, variables, or methods.

Main.java

public class Main { /** * Test all your classes well. The code below is given */ public static void main(String[] args) { Bank f = new Bank("Bank of JAVA"); // Interest Rate and monthly fees // f.setRate(0.1); f.setMonthFee(50); Individual chuck = new Individual(11315, Chuck); int chucktIdNum = f.createAccount(chuck, 1000); Individual susan= new collegestudent(12512, Susan, UNC, 1234); int susanIdNum = f.createAccount(susan, 500); Individual affluent = new Individual(51542, Affluent ); int affluentIdNum = f.createAccount(affluent, 1000000); Individual affluentcollegestudent = new collegestudent(23814, Affluent Student", Harvard, 1191); int affluentcollegestudentIdNum = f.createAccount(affluentcollegestudent, 100100); // another account for Affluent Student// f.createAccount(affluentcollegestudent, 30000); // another account for Susan// f.createAccount(susan, 100); // another account for Chuck // f.createAccount(chuck, 5000) System.out.println("Accounts: "); f.printAccounts(); System.out.println(); System.out.println(Susans Accounts: "); f.printAccountsForHolder(susan); System.out.println(); System.out.println(Interest : "); f.addInterest(); f.printAccounts(); System.out.println(); System.out.println(" Monthly fees: "); f.chargeMonthFee(); f.printAccounts(); System.out.println(); System.out.println(Affluent Individual purchases a Lamborghini , Susans wins the lottery, Affluent college Student pays tuition in full ..."); f.withdraw(affluentIdNum, 331000); f.printAccountsForHolder(affluent); f.deposit(susanIdNum, 100000); f.printAccountsForHolder(susan); f.withdraw(affluentcollegestudentIdNum, 45000); f.printAccountsForHolder(affluentcollegestudent); System.out.println(); } }

individual.java

protected int IdNum; protected String name; protected String address; public Individual (int IdNum, String name) { // your code here } public void setAddress(String address) { // your code here } public String getAddress() { // your code here } public int getIdNum() { // your code here } public String getName() { // your code here } // override the toString method to return: Individual: " + name // your code here // override the equals method to return true if the ID and name are equal public boolean equals(Object other) { // your code here }

RegularAccount.java

protected int IdNum; protected Individual holder; protected String bank; protected double balance; // never negative// protected double Rate; // the interest rate is 0.02 for 2% protected double monthFee; public RegularAccount(int IdNum, Individual holder, String bank) { // your code here } /** * Deposit amount if positive. If Negative amounts are ignored. * * @param amount The amount to deposit * @return The balance after deposit was accepted */ public double deposit(double amount) { // your code here } /** * Withdraw the given amount if positive and if there are enough funds. * Negative amounts are ignored. If the amount to be withdrawn is higher than the balance, * withdraw the entire balance. * * @param amount The amount to withdraw * @return The amount withdrawn */ public double withdraw(double amount) { // your code here } public double getBalance() { // your code here } public int getIdNum() { // your code here } public Individual getHolder() { // your code here } public void setRate(double Rate) { // your code here } public void setMonthFee(double monthFee) { // your code here } /** * Add the accrued interest to the account. * E.g. If balance is 100 and interest rate is 0.02, balance should become 102. */ public void addInterest() { // your code here } /** * Withdraw the account monthly fee * * @return The fee collected */ public double chargeMonthFee() { // your code here } // override the toString method to return: "Account of " + owner + " with ID " + account IdNum + " and a balance of " + balance // your code here // override the equals method to return true if the IdNum and bank name are equal public boolean equals(Object other) { // your code here }

Bank.java

public class Bank { private RegularAccount[] a; private String name; private double monthFee; private double Rate; private int IdNum; private final double WEALTHY_LIMIT = 100000; /** * Construct a bank with initial capacity for only 2 accounts */ public Bank(String name) { this.name = name; a = new RegularAccount[2]; } // set interest rate for accounts// public void setRate(double Rate) { // your code here } // Set the monthly fee amount for the bank and all the accounts in it // public void setMonthFee(double monthFee) { // your code here } WealthyAccount.java

// A wealthy account has all the behaviors and properties of a regular account, // but a zero monthly fee is collected from a wealthy account // and when interest is added, it is added twice: // e.g balance 100, interest Rate = 0.1 => 110 (from first interest added) => 121 (from second interest added) public WealthyAccount(int IdNum, Individual holder, String bank, double balance) { // your code here } // your code here // override the toString method to return: Wealthy " + whatever the regular account returns // your code here

CollegeStudent.java

// A collegeStudent has all the behaviors and properties of an Individual

protected int studentId; protected String college; public CollegeStudent(int IdNum, String name, String college, int studentid) { // your code here } public String getCollege() { // your code here } public int getStudentId() { // your code here } // override the toString method to return: collegestudent: " + name + " at " + college // your code here

CollegeStudentAccount.java

// A college student account is the same as a regular account // but a zero monthly fee is collected from a student account public CollegeStudentAccount(int IdNum, collegestudent holder, String bank) { // your code here } // your code here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!