Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class BankAccount { public BankAccount(); BankAccount (int accNr, double initBalance), void setAccNr(int nr); int getAccNr() const; double getBalance( ) const; void deposit (double amnt), void

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

class BankAccount { public BankAccount(); BankAccount (int accNr, double initBalance), void setAccNr(int nr); int getAccNr() const; double getBalance( ) const; void deposit (double amnt), void withdraw(double amnt); void displayAccInfo() const; //display accur and balance private int accNr; double balance, } 4.3 Consider the following code SavangsAccount myAccount, myAccount.BankAccount: displayAccInfo(); Which version of displayAccInfo () will be executed with this function call, the one in BankAccount or the one in SavingsAccount? (1) Member function post InterestRate() adds earned interest to the balance Show how to adapt class BankAccount to allow postInterestRate() to access the member vanable balance by name and explain why the adaptation is done in this way (2) 4.4 class BankAccount { public BankAccount(); BankAccount (unt accnr, double initBalance), 6 void setAccNr(int nr); int getAccNr() const; double getBalance( ) const; void setAccNr(int nr); int getAccNr() const; double getBalance ( ) const; void deposit (double amnt), void withdraw (double amnt); void displayAccInfo() const; //display accur and balance private int accNr; double balance, } 41 Derive a class SavingsAccount from class BankAccount This class has an additional member variable interestRate representing the interest rate on the savings account The class also has additional member functions set InterestRate(), getInterestRate() and Post InterestRate() Member function postInterest Rate () adds earned interest to the balance The class should override member function displayAccInfo () to display the account number, current balance and interest rate. Provide only the interface of class SavngsAccount in terms of a header file The header file should contain compiler directives to prevent multiple definitions Assume that the interface of class BankAccount is contained in an interface file called BankAccount h (9) 4.2 Implement the overloaded constructor for the class SavingsAccount by invoking the base class constructor (3) 4.3 Consider the following code SavingsAccount myAccount, myAccount. BankAccount: displayAccInfo(); Which version of displayAccInfo() will be executed with this function call, the one in BankAccount or the one in SavingsAccount? 4.4 Member function post Interest Rate () adds earned interest to the balance Show how to adapt class BankAccount to allow postInterestRate() to access the member vanable balance by name and explain why the adaptation is done in this way (2)

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_2

Step: 3

blur-text-image_3

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

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

Students also viewed these Databases questions

Question

a. How will the leader be selected?

Answered: 1 week ago