approvedwritershub.com
  • HOME
  • ABOUT US
  • HOW IT WORKS
    • TERMS AND CONDITIONS
  • SERVICES
  • BLOGS
  • LATEST REVIEWS
  • LOG IN
  • ORDER NOW
  • Search
  • Menu Menu
Blog - Latest News
You are here: Home1 / Java – Bank Account Program homework help

Java – Bank Account Program homework help

January 25, 2024/in Assignment Help, Homework Help /by Daniel Jennings

Java – Bank Account Program homework help

Java – Bank Account Program

**Disclaimer: This must be unique. I know there are solutions for this already posted on the site, but they fail the originality check tremendously. **

 

Create a class called BankAccount. The BankAccount class should contain a String to store the customer name and a double to store the account balance. The BankAccount class should have two constructors, as follows:

public BankAccount(String name, double balance)

            throws NegativeAmountException 

  {

    // set name and balance 

    // make sure balance is not negative

    // throw exception if balance is negative

  }

  public BankAccount(String name)

            throws NegativeAmountException 

  {

    // set name and use 0 balance 

  }

As can be seen, the first constructor throws a NegativeAmountException if the balance being used to create the bank account is negative. You will have to create this exception class yourself.

The BankAccount class should also contain methods to make a deposit, make a withdrawal, get the current balance, and print a bank account statement. The interfaces for these methods should appear as follows:

// update balance by adding deposit amount

// make sure deposit amount is not negative

// throw exception if deposit is negative

public void deposit(double amount) throws NegativeAmountException

  // update balance by subtracting withdrawal amount

// throw exception if funds are not sufficient

// make sure withdrawal amount is not negative

// throw NegativeAmountException if amount is negative

// throw InsufficientFundsException if balance < amount

  

  public void withdraw(double amount)

                 throws InsufficientFundsException, NegativeAmountException

// return current balance

  

  public double getBalance()

// print bank statement including customer name

// and current account balance

  public void printStatement();

Use the BankAccount class as the superclass for a SavingsAccount class. In addition to the behaviors of a BankAccount, a SavingsAccount also accumulates interest; therefore, the SavingsAccount class contains a double that is populated with the current interest rate. In addition to its constructors (you decide what the constructors should be), the SavingsAccount class should contain the following methods:

// post monthly interest by multiplying current balance

// by current interest rate divided by 12 and then adding

// result to balance by making deposit

  

  public void postInterest()

// print bank statement including customer name

// and current account balance (use printStatement from

// the BankAccount superclass)

// following this also print current interest rate

  

  public void printStatement()

Once these two classes are completed, create a driver class called FinalExam containing a main method that tests the SavingsAccount class. Within the driver test class, create a SavingsAccount object and then use it to make deposits and withdrawals, and to post the monthly interest.

To make the program simpler, you can incorporate the initial data for the Savings Accounts directly in the program (e.g., no need to prompt for the account holder name or starting balance). The only things you need to prompt for are the deposit amount and the withdrawal amount. Also, to simplify the task, the only exceptions that you should handle are the NegativeAmountException and the InsufficientFundsException. If either of these exception conditions occurs, print an appropriate error message and terminate the application. You can simply re-throw any IOExceptions from the main.

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!

Share this:

  • Facebook
  • X
Tags: Java - Bank Account Program homework help
Share this entry
  • Share on Facebook
  • Share on Twitter
  • Share on WhatsApp
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Vk
  • Share on Reddit
  • Share by Mail
  • Link to Dribbble
0 0 Daniel Jennings Daniel Jennings2024-01-25 16:55:522024-01-25 16:57:58Java – Bank Account Program homework help

MAKE YOUR ORDER NOW!

1. Fill in the order form

Issue instructions for your paper in the order form. Include a discount code if you have one. Your account will be created automatically.

2. Payment Procedure

Your payment is processed by a secure system. We accept MasterCard, Visa, Amex and Discover. No information is shared with 3rd parties.

3. The Writing Process

Clarify all the questions with customer support representatives and upload all the necessary files for the writer to use.

4. Download Your Paper

Check your paper. If it meets your requirements, approve and download it. If changes are needed, request a revision.

WHY WE ARE THE BEST

  1. 100% non-plagiarized Papers
  2. Free Plagiarism Reports
  3. Dedicated RN writers
  4. 24/7  Support Services
  5. Affordable Prices
  6. Money-back and Privacy guarantees
  7. Unlimited Amendments upon request
  8. Satisfaction guarantee

DISCLAIMER

Approvedwritershub.com helps students cope with college assignments and write papers on a wide range of topics. We deal with academic writing, creative writing, and non-word assignments.

PAYMENT METHODS

CONTACT US

E MAIL:

support@approvedwritershub.com

WhatsApp: +1(925)3749165

Online Chat 24/7

Archive

  • December 2024
  • November 2024
  • October 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • January 2022
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
© Copyright - approvedwritershub.com - powered by Enfold WordPress Theme
Exp19 Excel Ch11 ML1 Internships Assignment Help Principles of Software Engineering
Scroll to top
Open chat
WhatsApp
Hello
Can we help you?