Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

## Evaluation criteria and functional requirements * The project must not have any build errors. * Code is presented in a clean, organized format. *

## Evaluation criteria and functional requirements
* The project must not have any build errors.
* Code is presented in a clean, organized format.
* Code is appropriately encapsulated.
* Inheritance is used appropriately to avoid code duplication.
* The code meets the specifications defined in the remainder of this document.
## Bank teller application
**Notes for All Classes**
- All attributes have `private` access.
- X in the get column indicates the attribute *must have a `get` accessor*.
- X in the set column indicates the attribute *must have a `set` accessor*.
## Testing
The exercise tests have been organized into three categories.
The first category of tests check the structure of a class. If it's a subclass, does it extend the correct superclass? Are the correct constructors in place? What about the fields and their getters and setters, are they present in code? Finally, are the required methods and their parameters at least defined?
The second category tests the happy path behaviors of a class. Do the constructors set the fields they're supposed to? Do the methods produce the correct results?
The last category checks the edge case behaviors of a class. Are default values correctly set? Do methods handle boundary values?
The tests in the second and third categories are ignored until all the tests in the first category pass. That is, you'll need to create a well-formed class before the tests in the other categories are even run. Similarly, the edge case tests are ignored until the happy path tests pass. **Because the three categories are dependent upon one another, you need to run the tests on the class-level rather than individually running a test as you might normally do.**
You don't need to successfully pass all three categories of the `BankAccount` tests before moving onto either the `CheckingAccount` or `SavingsAccount`, but you're strongly encouraged to successfully pass at least the happy path behavioral tests for the `BankAccount` class given the other two are subclasses of it.
Finally, beyond saying the balance defaults to 0 and the constructors set the `accountHolderName` and `accountNumber` fields, the `BankAccount` specification is silent regarding the *state* of the class. For instance, there's no prohibition on initializing an account with balance less than 0, or depositing a negative amount. This is intentional. The exercise is on inheritance and overriding, *the tests only confirm the behaviors actually described in any of the specifications*.
## Instructions
Create three new classes to represent a bank account, savings account, and a basic checking account.
### Step One: Implement the `BankAccount` class
The `BankAccount` class represents a basic checking or savings account at a bank.
| Constructor | Description |
|------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| BankAccount(String accountHolderName, String accountNumber)| A new bank account requires an account holder name and account number. The balance defaults to a 0 dollar balance. |
| BankAccount(String accountHolderName, String accountNumber, int balance)| A new bank account requires an account holder name and account number. The balance is initialized to the dollar balance given. |
| Attribute Name | Data Type | Get | Set | Description |
|-----------------|---------|---|-------|------------------------------------------------------------|
| accountHolderName | String | X || Returns the account holder name that the account belongs to.|
| accountNumber | String | X || Returns the account number that the account belongs to.|
| balance | int | X || Returns the balance value of the bank account in dollars. |
| Method Name | Return Type | Description |
|------------------------------|-----------|-------------------------------------------------------------------------------------------------------|
| deposit(int amountToDeposit)| int | Adds `amountToDeposit` to the current balance, and returns the new balance of the bank account. `amountToDeposit` must be greater than zero. |
| withdraw(int amountToWithdraw)| int | Subtracts `amountToWithdraw` from the current balance, and returns the new balance of the bank account. `amountToWithdraw` must be greater than zero. |
### Step Two: Implement the `CheckingAccount` class
A `CheckingA

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_2

Step: 3

blur-text-image_3

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

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

Show that (x) = 2x 3 + 2x + sin x + 1 has precisely one real root.

Answered: 1 week ago