write a menu driven program that simulates the options for a Savings Account. 1. Instantiate 2 Accou

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:

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

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

//********************************************************************
// 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 – 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));
   }
}

 

Looking for a Similar Assignment? Let us take care of your classwork while you enjoy your free time! All papers are written from scratch and are 100% Original. Try us today! Use Code FREE15