Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this task you are asked to create a BankAccount class. This class will need to keep track of an account balance and interest rate,

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

For this task you are asked to create a BankAccount class. This class will need to keep track of an account balance and interest rate, and provide methods for manipulating these fields and calculating interest The BankAccount class will be used as an object, and as such will need to have non-static fields and methods. The account balance and interest rate will need to be private variables that can only be accessed or modified through public methods. Here are a list of methods that you need to implement for BankAccount. A class structure has been provided for you- you will just need to write code where the comments tell you to . BankAccount() The default constructor. This creates a new account with a balance of $0 and an interest rate of 7.7% BankAccount (startingBalance) This constructor creates a new account with a balance of startin gBalance and an interest rate of 7.7% .BankAccount (startingBalance, interestRate) This constructor creates a new account with a balance of $startingBalance and an interest rate of interest Rate% Withdraw (amount) If there is enough money in the account, this method subtracts amount from the current balance and returns true. If there isn't enough, this method leaves the balance untouched and instead returns false .Deposit(amount) This method adds amount to the current balance QueryBalance() This method returns the current balance of the account SetInterestRate (interestRate) This method sets the interest rate of the account to interest Rate%. You can assume that the interest rate is entered as a percent, ie. 4.4 rather than 0.044 .GetInterestRate() This method returns the current interest rate of the account. If the interest rate is 7.7% this method should return 7.7

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions