Skip to content

Conversation

@Tezz03
Copy link
Contributor

@Tezz03 Tezz03 commented Apr 14, 2025

need an extension


import com.codedifferently.lesson17.bank.exceptions.InsufficientFundsException;

public class BusinessAccount extends CheckingAccount {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prolly should be called BusinessCheckingAccount for more clarity.

* @throws InsufficientFundsException If there are insufficient funds in the account.
*/
@Override
public void withdraw(double amount) throws InsufficientFundsException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't even need to override the superclass method since it does the same thing.

* @param owners The owners of the account.
* @param initialBalance The initial balance of the account.
*/
public BusinessAccount(String accountNumber, Set<Customer> owners, double initialBalance) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check that one of the owners is a business, right?

*/
public Check(String checkNumber, double amount, CheckingAccount account) {
if (amount < 0) {
public Check(String checkNumber, double amount, CheckingAccount account, SavingsAccount savings) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you need to change the constructor? You can only write checks against checking accounts.



/** Represents a savings account, which does not support check writing. */
public class SavingsAccount extends CheckingAccount {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make sense to me. How is a savings account a kind of checking account?

* @param check The amount to write on the check.
* @throws UnsupportedOperationException Always, since savings accounts don't support checks.
*/
public void writeCheck(Check check) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why even have this method if you can't write checks account savings accounts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be still WIP so I'll ignore for now.

}

@Test
void writeCheck() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code formatting looks wrong, please fix.

Copy link
Contributor

@anthonydmays anthonydmays left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your pull request names are still terrible. You should do something about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants