Question: //******************************************************************** // Account.java Java Foundations // // Represents a bank account with basic services such as deposit // and withdraw. //******************************************************************** import java.text.NumberFormat; public class
//******************************************************************** // Account.java Java Foundations // // Represents a bank account with basic services such as deposit // and withdraw. //******************************************************************** import java.text.NumberFormat; public class Account { private final double RATE = 0.035; // interest rate of 3.5% private String name; private long acctNumber; private double balance; //----------------------------------------------------------------- // Sets up this account with the specified owner, account number, // and initial balance. //----------------------------------------------------------------- public Account (String owner, long account, double initial) { name = owner; acctNumber = account; balance = initial; } //----------------------------------------------------------------- // Deposits the specified amount into this account and returns // the new balance. The balance is not modified if the deposit // amount is invalid. //----------------------------------------------------------------- public double deposit (double amount) { if (amount > 0) balance = balance + amount; return balance; } //----------------------------------------------------------------- // Withdraws the specified amount and fee from this account and // returns the new balance. The balance is not modified if the // withdraw amount is invalid or the balance is insufficient. //----------------------------------------------------------------- public double withdraw (double amount, double fee) { if (amount+fee > 0 && amount+fee < balance) balance = balance - amount - fee; return balance; } //----------------------------------------------------------------- // Adds interest to this account and returns the new balance. //----------------------------------------------------------------- public double addInterest () { balance += (balance * RATE); return balance; } //----------------------------------------------------------------- // Returns the current balance of this account. //----------------------------------------------------------------- public double getBalance () { return balance; } //----------------------------------------------------------------- // Returns a one-line description of this account as a string. //----------------------------------------------------------------- public String toString () { NumberFormat fmt = NumberFormat.getCurrencyInstance(); return (acctNumber + "\t" + name + "\t" + fmt.format(balance)); } }
write a menu driven program that simulates the options for a Savings Account.
1. Instantiate 2 Accounts in your Driver.
2. Hard code the following information to initialize each account:
Customer Name ("First Last")
Account number
Initial Balance
3. Prompt the User to enter her/his account number. Display an error message if the account number does not exist. Display the menu below if the account number is valid.
Your menu will offer the following options:
Deposit
Withdrawal
Returns Balance
Returns Balance with Interest
Returns Account Number
Returns all Account Information
Exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
