Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do in C++ and this is all the information 1. BankAccount.cpp file code #include BankAccount.h #include #include using namespace std; BankAccount::BankAccount(string pName, double pCurrentBalance)

Please do in C++ and this is all the information

1. BankAccount.cpp file code

#include "BankAccount.h" #include  #include  using namespace std; BankAccount::BankAccount(string pName, double pCurrentBalance) { name = pName; balance = pCurrentBalance; } BankAccount::BankAccount() { balance = 0; name = "No Name"; } void BankAccount::deposit(double amount) { balance += amount; } void BankAccount::withdraw(double amount) { if (balance >= amount) { balance -= amount; } else { std::cout << "ERROR: Cannot withdraw " << amount << " since current balance is " << balance << std::endl; } } int BankAccount::getBalance() { return balance; } string BankAccount::getName() { return name; } 

2. Bankaccount.h file

#ifndef BACKACCOUNT_DEFINED #define BACKACCOUNT_DEFINED 1 #include  class BankAccount { public: //constructors BankAccount(std::string, double); // post: Construct call with two arguements: // BankAccount("Tom DeJong", 100.00) BankAccount(); // post: Construct call with no arguements // default name = "NoName", balance = 0 //public methods void deposit(double amount); // post: Credit amount from balance void withdraw(double amount); // pre: Check if withdraw <= balance // post: Debit amount from balance // observer methods int getBalance(); // post: return balance std::string getName(); // post: return name //private variables private: std::string name; //stores name double balance; //stores balance }; #endif 

Files you will be submitting: 8B_BankTell.cpp with output Notes: Remember to add your information to output and copy and paste output to the bottom of the main program Points: 10

General Directions:

You will be writing 8B_BankTeller.cpp from scratch. Make sure you place all 3 files in the project folder on your hard drive.

Download (replace if necessary) BankAccount.h and BankAccount.cpp files that are attached above and place them in your project folder.

In your assignment file, include, be sure to: #include "BankAccount.h", , and

Create some local variables store name and starting balance and pass thosevalues to a new object of BankAccount.

Use the BankAccount class to store and retrieve name and balance.

Create a menu system that will have a post-condition do-while loop that will loop until choice (choice is a char) = "Q". Use toupper on choice so it will accept upper or lower case characters.

W)ithdraw, D)eposit, or Q)uit:

Use a switch statement with cases 'W', 'D', or 'Q' to withdraw, deposit, or quit. Include a default that will return a error (option not available).

Note that BankAccount class will return an error that you can use if you try to withdraw too much.

On exiting your program, report the balance.

Please mimic the following output for your output.

Output:

/*

Student Name, CIS127, Assignment 8.1

Enter customer name: Thomas DeJong Enter initial balance: 0 W)ithdraw, D)eposit, or Q)uit: d Enter deposit amount: 250 W)ithdraw, D)eposit, or Q)uit: w Enter withdrawal amount: 300 ERROR: Cannot withdraw 300 since current balance is 250 W)ithdraw, D)eposit, or Q)uit: w Enter withdrawal amount: 200 W)ithdraw, D)eposit, or Q)uit: q Thank you for your business Thomas DeJong Ending balance: 50 Press any key to continue . . . */

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

17. As new data becomes available, repeat steps 11 through 16.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

I W/7y were you so motivated and able to work so productively?

Answered: 1 week ago