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!

Description This is a standard version of Project 2. Since this is our first OOP p rogram, we need to get some experience on how this method works. We do not start from scratch, we will build on top of the code on section 13.13 of our textbook. First you run the program 18-15 on page 784. Then you will add some new features into this program by modifying t he code Objectives: . Get used to the new approach of the Object-Oriented Programming Understand the advantages of the classes that contain the features Get used to handling relatively long code Requirements 1. (Menu) First we edit the menu part by adding some new features. We keep the original menu items A)-G). Then we add the following menu items: e Item I) Make an investment Item R) Make a retirement contribution . Item S) Display the amount of the retirement fund e Item W) Withdraw from the investment Item X) Display the amount of the investment fund Next we will implement these new features by adding some member variables and member functions. 2. (Member Variables) We need two member variables to store the investment amount and the amount of the retirement fund. . Add a private member: double investmentAmount to store the total amount that a user puts the money into the investment fund within the account . Add a private member: double retirementAmount to store the total amount that a user puts the money into the retirement fund within the account Description This is a standard version of Project 2. Since this is our first OOP p rogram, we need to get some experience on how this method works. We do not start from scratch, we will build on top of the code on section 13.13 of our textbook. First you run the program 18-15 on page 784. Then you will add some new features into this program by modifying t he code Objectives: . Get used to the new approach of the Object-Oriented Programming Understand the advantages of the classes that contain the features Get used to handling relatively long code Requirements 1. (Menu) First we edit the menu part by adding some new features. We keep the original menu items A)-G). Then we add the following menu items: e Item I) Make an investment Item R) Make a retirement contribution . Item S) Display the amount of the retirement fund e Item W) Withdraw from the investment Item X) Display the amount of the investment fund Next we will implement these new features by adding some member variables and member functions. 2. (Member Variables) We need two member variables to store the investment amount and the amount of the retirement fund. . Add a private member: double investmentAmount to store the total amount that a user puts the money into the investment fund within the account . Add a private member: double retirementAmount to store the total amount that a user puts the money into the retirement fund within the account

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

More Books

Students also viewed these Databases questions

Question

What are the two general purposes of budgeting?

Answered: 1 week ago