Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment # 2 ( 1 0 points ) Create an inheritance hierarchy containing base class Account and derived class CheckingAccount that inherit from class Account.

Assignment # 2(10 points)
Create an inheritance hierarchy containing base class Account and derived class CheckingAccount that inherit from class Account.
\table[[Account class],[Data member,Data member of type double to represent the account balance.,1pt],[Constructor,\table[[Should receives an initial balance and uses it to initialize the data member. The],[constructor should validate the initial balance to ensure that it is greater than or],[equal to 0.0.],[(If not, the balance should be set to 0.0 and the constructor should display an],[error message, indicating that the initial balance was invalid).]],1pt],[\table[[Member],[functions]],\table[[- Member function credit should add an amount to the current balance.],[- Member function debit should withdraw money from the Account and],[ensure that the debit amount does not exceed the Account's balance.],[(If it does, the balance should be left unchanged and the function should],[print the message "Debit amount exceeded account balance").]],2pt],[CheckingAccount class],[Data member,Data member of type double that represents the fee charged per transaction.,1pt],[Constructor,\table[[Should receive the initial balance, as well as a parameter indicating a fee],[amount]],1pt],[\table[[Member],[functions]],\table[[Redefine member functions credit and debit as follows:],[- CheckingAccount's versions of these functions should invoke the base-class],[Account version to perform the updates to an account balance.],[- CheckingAccount's debit function should charge a fee only if money is],[actually withdrawn (i.e., the debit amount does not exceed the account],[balance).],[[Hint: Define Account's debit function so that it returns a bool indicating whether],[money was withdrawn. Then use the return value to determine whether a fee],[should be charged.]]],2pt],[Main function ( to test classes )],[\table[[- Write a pro],[class.]],\table[[gram that creates objects of each class and tests one member function for each]],1pt]]
image text in transcribed

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

what factors affect the probability of hedge fund defunct?

Answered: 1 week ago

Question

7. Understand the challenges of multilingualism.

Answered: 1 week ago

Question

5. Give examples of variations in contextual rules.

Answered: 1 week ago