The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
The L&L Bank can handle up to 30 customers who have savings accounts. Design and implement a program that manages the accounts. Keep track of key information and allow each customer to make deposits and withdrawals. Produce appropriate error messages for invalid transactions. Also provide a method to add 3 percent to all accounts whenever the method is invoke.
this is what i have so far i don't know what i am doing wrong i have tried to change some things in the code but still i get error messages. Please help me out I need to send this project today please.
Â
import java.text.NumberFormat;class Account{private String name;private long accountNumber;private double balance;private final double rate = 0.03;public Account(String owner, long account, double balance){name = owner;accountNumber = account;balance = balance;}public String getName(){ return owner; }public String getAccountNumber(){ return account; }public double deposit(double amount){balance = balance + amount;return balance;}public double withdraw(double amount, double fee){balace = balance - amount - fee;return balance;}public double addInterest(){balance += (balance * rate);return balance;}public double getBalance(){ return balance; }public String toString(){NumberFormat fmt = NumberFormat.getCurrencyInstance();return "Name: " + name + " Account Number: " + accountNumber + " Balance: "+ ftm.format(balance);}}public class Bank{private static int MAXCUSTOMERS = 30;public boolean addCustomer(Account Customer){int numberOfCustomers = customers.size();if (numberOfCustomers >= MAXCUSTOMERS)return false;customers.put(aCustomer.getaccountNumber);return true;}public void removeCustomer(Account aCustomer){customers.remove(aCustomer.getAccount); }public void addInterest(){Iterator<Customer> i = customers.values().iterator();while (i.hasNext()){Customer aCustomer = i.next();aCustomer.deposit(aCustomer.getBalance * INTEREST_RATE);
-----------