Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

o nums+ 6) what does this m X+ 5. Design BankAccount class, which lets the account owner to depositand withdraw money using a password. The

image text in transcribed
image text in transcribed
image text in transcribed
o nums+ 6) what does this m X+ 5. Design BankAccount class, which lets the account owner to depositand withdraw money using a password. The class you write should meet the following requirements: There should be no default constructor. There should be only one constructor, which takes in the initial balance in dollars, and the password. The password is an integer, most likely 4 digits, but we won't enforce that limit here (which means it can even be negative) The initial amount, however, must not be negative, if it is negative, set it to $0.00 by default. Your BankAccount class should be able to keep track of the balance up to the last cent. It should support two operations, deposit and withdraw. Both must be Boolean functions. One must specify the amount of money he wants to deposit/withdraw, and the password. If the password is incorrect, the return value must be false. Also, for withdraw, if the requested amount exceeds the current balance or is negative, return false and do not change anything. If the deposit amount is negative, do not change the balance and return false. a. b. c. d. Add a Boolean function setPassword, which takes in two passwords-the original password and the new password. If the original password does not match, return false and do not change the password. If the original password is correct, update the password with the new password. Provide an accessor function balance, which accepts the password. If the password is correct, return the balance. If not, return -1. e. f You can create private member functions A possible usage of this class looks like this: ccount ba (500, 1234lh initial amount: 500, password: 1234 sK "S" ss ba.balance t1234) s endl: "3"

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions