Question: Account is a class that models the basic working of a bank account. Here is the class definition: class Account { private: double balance; //

Account is a class that models the basic working of a bank account. Here is the class definition:

class Account

{

private:

double balance; // Account balance

double interestRate; // Annual interest rate

double interest; // Annual interest earned

int transactions; // Number of transactions

public:

/*initialize the balance and interest rate by the parameters or the default values, here is the annual interest rate is 0.045 */

Account(double iRate = 0.045, double bal = 10);

//set the interest rate

void setInterestRate(double iRate);

//make a deposit

void deposit(double amount);

/*withdraw some amount from the balance. If the amount is greater than the balance, the function returns false; otherwise this amount is subtracted from the balance and returns true. */

bool withdraw(double amount);

//calculate annual interest and add it to the balance

void calcInterest();

// retrieve the interest rate

double getInterestRate() const;

// retrieve the balance

double getBalance() const;

// retrieve the annual interest

double getInterest() const;

//retrieve the number of transactions

int getTransactions() const;

//overload equal to operator ==. Two accounts are equal if all of their data members

//are same

bool operator== (const Account& );

};

Question 17 (2 points)

Now let us create an account using the class Account. Which of the following statement is to declare and initialize an object account1 of the class Account with the balance $1345.30 and interest rate 2.5%?

Question 17 options:

a Account account1 = (0.025, 1345.30);
b Account account1 (0.025, 1345.30);
c Account account1 (1345.30, 0.025);
d Account account1 =0.025, 1345.30;
e None of these answers

Question 18 (2 points)

Let's deposit some money for account1 in the previous question. Which of the following statements is to deposit $700 to account1?

Question 18 options:

a None of these answers
b account1.balance = account1.balance + 700;
c Account.account1=700;
d account1.deposit = 700;
e account1.deposit(700);

Question 19 (2 points)

Now we would like to withdraw some money. Which of the following statements is to withdraw $80 from the account1?

Question 19 options:

a account1.withdraw = 80
b None of these answers
c account1.withdraw(80);
d account1 = account1 - 80;
e account1.balance = account1.balance - 80;

Question 20 (2 points)

Which of the following statement is to display the balance of account1?

Question 20 options:

a cout<
b cout << account1;
c cout<
d cout<
e None of these answers

Question 21 (2 points)

to know the amount of balance that account1 will grow after one year, which of the following statement is correct? Suppose we have declared balanceAmount as follows:

double balanceAmount;

Question 21 options:

a balanceAmount=account1.balance+account1.balance*account1.interest;
b balanceAmount=account1.getBalance()+account1.getInterest();
c account1.calcInterest();balanceAmount=account1.balance;
d balanceAmount=account1.getBalance()+account1.calcInterest();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!