Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, here is a C++ project about Object-oriented Programming program. Any answers would be appreciated! The description is below: The program 13-15 is about bank

Hi, here is a C++ project about Object-oriented Programming program. Any answers would be appreciated!

The description is below:

image text in transcribed

image text in transcribed

The program 13-15 is about bank account managing and the source code related are below:

Account.h file:

// Specification file for the Account class. #ifndef ACCOUNT_H #define ACCOUNT_H

class Account { private: double balance; // Account balance double interestRate; // Interest rate for the period double interest; // Interest earned for the period int transactions; // Number of transactions public: Account(double iRate = 0.045, double bal = 0) { balance = bal; interestRate = iRate; interest = 0; transactions = 0; }

void setInterestRate(double iRate) { interestRate = iRate; } void makeDeposit(double amount) { balance += amount; transactions++; } bool withdraw(double amount); // Defined in Account.cpp void calcInterest() { interest = balance * interestRate; balance += interest; } double getInterestRate() const { return interestRate; } double getBalance() const { return balance; } double getInterest() const { return interest; } int getTransactions() const { return transactions; } }; #endif

Account.cpp file:

// Implementation file for the Account class. #include "Account.h"

bool Account::withdraw(double amount) { if (balance

Pr13-15.cpp file:

// This program demonstrates the Account class. #include #include #include #include "Account.h" using namespace std;

// Function prototypes void displayMenu(); void makeDeposit(Account &); void withdraw(Account &);

int main() { Account savings; // Savings account object char choice; // Menu selection

// Set numeric output formatting. cout

do { // Display the menu and get a valid selection. displayMenu(); cin >> choice; while (toupper(choice) 'G') { cout > choice; } // Process the user's menu selection. switch(choice) { case 'a': case 'A': cout

return 0; }

//**************************************************** // Definition of function displayMenu. This function * // displays the user's menu on the screen. * //****************************************************

void displayMenu() { cout

//************************************************************* // Definition of function makeDeposit. This function accepts * // a reference to an Account object. The user is prompted for * // the dollar amount of the deposit, and the makeDeposit * // member of the Account object is then called. * //*************************************************************

void makeDeposit(Account &acnt) { double dollars;

cout > dollars; cin.ignore(); acnt.makeDeposit(dollars); }

//************************************************************* // Definition of function withdraw. This function accepts * // a reference to an Account object. The user is prompted for * // the dollar amount of the withdrawal, and the withdraw * // member of the Account object is then called. * //*************************************************************

void withdraw(Account &acnt) { double dollars;

cout > dollars; cin.ignore(); if (!acnt.withdraw(dollars)) cout

Please leave any information you may need for this project.

Thank you!

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

Building The Data Lakehouse

Authors: Bill Inmon ,Mary Levins ,Ranjeet Srivastava

1st Edition

1634629663, 978-1634629669

More Books

Students also viewed these Databases questions

Question

What conditions in an organization enhance leadership development?

Answered: 1 week ago

Question

10.

Answered: 1 week ago