Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The java programing question goes like this: Write two classes to describe BankAccount objects. A bank account is described by the account owner's name, an

The java programing question goes like this:

Write two classes to describe BankAccount objects.

A bank account is described by the account owner's name, an account ID (stored as text), and the balance in the account.

A savings account is a type of bank account that is described by this same information and also by an interest rate.

In each class, include (or use inherited versions of):

instance data variables

two constructors

one constructor takes a starting balance; the second constructor creates an account with no money

you decide what other parameters should be included in each

getters and setters

include appropriate value checks when applicable

a toString method

you decide the output

a deposit method

include appropriate value checks

a withdrawal method

include appropriate value check

I already did some part:

public class SavingsAccount extends BankAccount {

private double interestRate;

private double minBalance;

// private static final double DEFAULD_BALANCE = 0.00;

public SavingsAccount(String name, String id, double balance, double interestRate, double minBalance) {

super(name, id, balance);

this.interestRate = interestRate;

this.minBalance = minBalance;

}

/*

* public SavingsAccount(String name, String id,double interestRate){

*

* this(name, id, DEFAULD_BALANCE, interestRate); }

*/

public double getInterestRate() {

return interestRate;

}

@Override

public void setBalance(double newBalance) {

if (newBalance >= minBalance) {

balance = newBalance;

}else {

System.out.println("Invalid Value.");

}

}

public void setInterstRate(double newInterestRate) {

interestRate = newInterestRate;

}

@Override

public String toString() {

String s = super.toString() + "\tInterest Rate: " + interestRate;

return s;

}

@Override

public boolean withdrawal(double withdrawleValue) {

if ((balance - withdrawleValue) >= minBalance) {

return super.withdrawal(withdrawleValue);

} else {

System.out.println("Banlance cannot be less than minimun balance. ");

return false;

}

}

}

My question is :

Include a minimum balance as part of what describes a savings account. Update the class as necessary, making sure that the account is not allowed to go below this minimum balance. (use the saving account program above)

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

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

In Problem, find each derivative and simplify. a-3

Answered: 1 week ago

Question

=+2. What is up with the Eagles?

Answered: 1 week ago

Question

=+21.1. Prove ( e-ux2 /2 dx =1-1/2. ,00 12 T = 00

Answered: 1 week ago