Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA HELP please!!! MUCH appreciated! also create TEST class for each SAVINGSACCOUNT, CHECKINGACCOUNT, IACCOUNT THANK YOU SO MUCH Design and implement the start of a

JAVA HELP please!!! MUCH appreciated! also create TEST class for each SAVINGSACCOUNT, CHECKINGACCOUNT, IACCOUNT

THANK YOU SO MUCH

Design and implement the start of a banking solution for a neighborhood bank. There are two types of accounts the bank wants you to implement: one called SavingsAccount and one called CheckingAccount

Both accounts can do the following:

  • Create a new account by specifying a starter amount of money to open it with. The starter amount must be greater than or equal to one cent. Do this: Create a constructor that takes a single double representing the starter amount for the account.
  • Deposit into their account. Do this: Create a method that takes a single double representing the amount deposited into the account. If the amount specified is negative, throw an IllegalArgumentException
  • Withdraw from their account. Do this: Create a method withdraw that reduces the account balance by the amount specified. Return true if the transaction is successful, false otherwise
  • Check their balance. Create a method getBalance that returns a double (the current account balance)

Non-customer behavior you must implement:

  • Bank administrators can perform monthly maintenance to assess monthly fees and give a clean slate for the subsequent month. Do this: Create a performMonthlyMaintenance method to charge any fees and then reset transaction counters to zero.
  • Do this: Create a toString method that prints the account balance in dollars/cents format (e.g: $10.00)

You are required to create an IAccount interface that both types of accounts implement, so that the bank can access either account through that common protocol. You will need to consider behavior variations as described below.

Behavior variations for a SavingsAccount withdraw method (only 6 withdrawal transactions per month; unlimited deposits per month) Rules:

  • if the amount specified is greater than the balance available, this operation fails and returns false.
  • If the amount specified is negative, the operation fails. If the number of withdrawals for the month is greater than 6, a transaction penalty of $14 is deducted from the account when monthly maintenance is performed

Behavior variations for a CheckingAccount performMonthlyMaintenance method (minimum balance required: $100 to avoid fees) Rules:

  • if the balance falls below $100 at ANY time during the month (before maintenance is performed) an account maintenance fee is charged when the monthly maintenance is performed.

Notes

For each method you write:

  • Design the signature of the method.
  • Write Javadoc-style comments for that method.
  • Write the body for the method.
  • Write one or more tests that check that the method works as specified in all cases.

Avoid duplicating code as much as possible. You will likely want to use an abstract superclass and push common method code up to that class. Feel free to create private helper methods if you need to.

Be sure to use access modifiers, private, default (no keyword), protected, and public appropriately.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

=+ What would it look like? Who should deliver it?

Answered: 1 week ago