Question
1. Modify the withdraw() method so that the balance cannot go under $100 after any withdraw transaction. 2. Overwrite the toString() method in both the
1. Modify the withdraw() method so that the balance cannot go under $100 after any withdraw transaction.
2. Overwrite the toString() method in both the client and account classes.
3. Write an addClient() method in the Bank class, this method should create a new client object, a new account object and link them together, then adds the client to an array of clients
in the Bank Class.
4. There are two possible kinds of bank accounts, either a checking account, or savings account. A savings account has an interest rate on the account balance.
5. Implement a method calculateInterest() in the savings account class. 6. Overwrite the deposit() method in the savings class to increment the balance with the interest. Make any necessary changes to make this work !! 7. Each client can have both a checking account and savings account. Modify the code to accommodate these two types of accounts for each client. 8. Complete the implementation of the Bank Driver main method to test all your functionalities.
package bank;
public class Bank {
public static void main(String[] args) { // Prompt the user to enter a client information // Create a new client object and add the client attributes to the object // Prompt the user to enter the opening balance for the client's account. // Check the balance is greater than $1000 // Create an account object and link it to the client you just created // Print out the client info along with his account info. } }
_________________________________________________________________
package bank;
public class Client { private String fname,lname, address; private long ssn; private long phoneNumber; private Account acc;
public Client(String fname, String lname, String address, long ssn, long phoneNumber) { this.fname = fname; this.lname = lname; this.address = address; this.ssn = ssn; this.phoneNumber = phoneNumber; }
public void setAddress(String address) { this.address = address; }
public void setPhoneNumber(long phoneNumber) { this.phoneNumber = phoneNumber; } public void printClientInfo() { System.out.println("Client fname: " + fname + "Last name: " + lname + " Address: " + address); } public boolean openAccount() { acc = new Account(100,1); return true; } }
______________________________________________________________
package bank;
public class Account { private double balance; private int accountNo;
public Account(double balance, int accountNo) { this.balance = balance; this.accountNo = accountNo; } public boolean withdraw(double amount) { if(balance >= amount) balance-= amount; else return false; return true; } public boolean deposit(double amount) { balance+= amount; return true; } public double checkBalance() { return balance; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started