Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started