Question

In: Computer Science

(In C++) Bank Account Program Create an Account Class Create a Menu Class Create a main()...

(In C++)

Bank Account Program

Create an Account Class

Create a Menu Class

Create a main() function to coordinate the execution of the program.

We will need methods:

  • Method for Depositing values into the account.

    • What type of method will it be?

  • Method for Withdrawing values from the account.

    • What type of method will it be?

  • Method to output the balance of the account.

    • What type of method will it be?

  • Method that will output all deposits made to the account.

  • Method that will output all withdraws made from the account.

**************************************

* Bank Account Program: *

* Enter # to run program or Quit *

* 1) Make a Deposit *     

* 2) Make a Withdrawal *    

* 3) Output balance *   

* 4) Output all deposits *

* 5) Output all withdrawals *

* 6) Quit *

**************************************

  • Attach Snipping Photo of Source Code and Output

    • Make sure to attach pictures of each menu option working.

Solutions

Expert Solution

if you have any Query comment Down Below

CODE:

#include <iostream>
#include <vector>
using namespace std;
class Account {
int balance;
vector<int> withdrawHistoryAmount;
vector<int> depositHistoryAmount;
public:
Account(){
balance=0;
}
Account(int bal){
balance=bal;
}
void deposit()   
{
int dep;
cout<<"\n Enter Deposit Amount = ";
cin>>dep;
if(dep>0){
balance+=dep;
depositHistoryAmount.push_back(dep);
}
}
void withdraw() //withdrawing an amount
{
int withdrawAm;
cout<<"\n Enter Withdraw Amount = ";
cin>>withdrawAm;
if(withdrawAm>balance)
cout<<"\n Cannot Withdraw Amount";
balance-=withdrawAm;
withdrawHistoryAmount.push_back(withdrawAm);
}
void outputBalance(){
cout<<"Total Amount : "<<balance<<endl;
}
void allDeposit(){
  
if(depositHistoryAmount.size()>0){
cout<<"All Deposit are :\n";
for (auto i = depositHistoryAmount.begin(); i != depositHistoryAmount.end(); ++i)
cout << *i << " ";
}
else{
cout<<"There is not Deposit History\n";
}
cout<<"\n";
}
void allWithdraw(){
  
if(withdrawHistoryAmount.size()>0){
cout<<"All allWithdraw are :\n";
for (auto i = withdrawHistoryAmount.begin(); i != withdrawHistoryAmount.end(); ++i)
cout << *i << " ";
}
else{
cout<<"There is not withdraw History\n";
}
cout<<"\n";
}
};
void menu(){
cout<<"**************************************\n";
cout<<"* Bank Account Program: *\n";
cout<<"* Enter # to run program or Quit *\n";
cout<<"* 1) Make a Deposit * \n";
cout<<"* 2) Make a Withdrawal * \n";
cout<<"* 3) Output balance *\n";
cout<<"* 4) Output all deposits *\n";
cout<<"* 5) Output all withdrawals *\n";
cout<<"* 6) Quit *\n";
cout<<"**************************************\n";
}
int main() {
  
char choice;
Account a;
menu();
cin>>choice;
if(choice=='#'){
while(choice!='6'){
switch(choice){
case '1':
a.deposit();
break;
case '2':
a.withdraw();
break;
case '3':
a.outputBalance();
break;
case '4':
a.allDeposit();
break;
case '5':
a.allWithdraw();
break;
}
menu();
cin>>choice;
}
}
cout<<"Thanks FOr using\n";
}

SS:


Related Solutions

Write a program to create a bank account and to process transactions. Call this class bankAccount...
Write a program to create a bank account and to process transactions. Call this class bankAccount A bank account can only be given an initial balance when it is instantiated. By default, a new bank account should have a balance of 0. A bank account should have a public get method, but no public set method. A bank account should have a process method with a double parameter to perform deposits and withdrawals. A negative parameter represents a withdrawal. It...
1. create a class called ArrayStack that is a generic class. Create a main program to...
1. create a class called ArrayStack that is a generic class. Create a main program to read in one input file and print out the file in reverse order by pushing each item on the stack and popping each item off to print it. The two input files are: tinyTale.txt and numbers.txt. Rules: You cannot inherit the StackofStrings class. 2. Using your new ArrayStack, create a new class called RArrayStack. To do this, you need a) remove the capacity parameter...
Confused about going through this C program. Thank you Program Specifications: *********************************************** ** MAIN MENU **...
Confused about going through this C program. Thank you Program Specifications: *********************************************** ** MAIN MENU ** *********************************************** A) Enter game results B) Current Record (# of wins and # of losses and # of ties) C) Display ALL results from all games WON D) Display ALL results ordered by opponent score from low to high. E) Quit Your program will have a menu similar to the example above. The game results will simply be the score by your team and...
c++ The above Account class was created to model a bank account. An account has the...
c++ The above Account class was created to model a bank account. An account has the properties (keep the properties private) account number, balance, and annual interest rate, date created, and functions to deposit and withdraw. Create two derived classes for checking and saving accounts. A checking account has an overdraft limit, but a savings account cannot be overdrawn. Define a constant virtual toString() function in the Account class and override it in the derived classes to return the account...
Write a C++ program (The Account Class) Design a class named Account that contains (keep the...
Write a C++ program (The Account Class) Design a class named Account that contains (keep the data fields private): a) An int data field named id for the account. b) A double data field named balance for the account. c) A double data field named annualInterestRate that stores the current interest rate. d) A no-arg constructor that creates a default account with id 0, balance 0, and annualInterestRate 0. e) The accessor and mutator functions for id, balance, and annualInterestRate....
Class, Let's create a menu in Java. A menu is a presentation of options for you...
Class, Let's create a menu in Java. A menu is a presentation of options for you to select. You can do this in the main() method. 1. Create a String variable named menuChoice. 2. Display 3 options for your program. I recommend using 3 System.out.println statements and a 4th System.out.print to show "Enter your Selection:". This needs to be inside the do -- while loop. A. Deposit Cash. B. Withdraw Cash X. Exit Enter your Selection: 3. Prompt for the...
Create a new class called Account with a main method that contains the following: • A...
Create a new class called Account with a main method that contains the following: • A static variable called numAccounts, initialized to 0. • A constructor method that will add 1 to the numAccounts variable each time a new Account object is created. • A static method called getNumAccounts(). It should return numAccounts. Test the functionality in the main method of Account by creating a few Account objects, then print out the number of accounts
In C++ Language English/Spanish Translation Program. Create a menu driven program that translates English to Spanish...
In C++ Language English/Spanish Translation Program. Create a menu driven program that translates English to Spanish and Spanish to English. Your translation program should use arrays for this program. You will need to populate the arrays with the contents of the English and Spanish data files provided. The two files are ordered such that each word in the one file corresponds to the respective translation in the other (i.e.: the first word in the ENG.txt file corresponds to the first...
With PHP Create a class called Account that a bank might use to represent customers' bank...
With PHP Create a class called Account that a bank might use to represent customers' bank accounts. Your class should include one data member of type int to represent the account balance. Your class should provide a constructor that receives an initial balance and uses it to initialize the data member. The constructor should validate the initial balance to ensure that it is greater than or equal to 0. If not, the balance should be set to 0 and the...
Java Programming Create a class named Problem1, and create a main method, the program does the...
Java Programming Create a class named Problem1, and create a main method, the program does the following: - Prompt the user to enter a String named str. - Prompt the user to enter a character named ch. - The program finds the index of the first occurrence of the character ch in str and print it in the format shown below. - If the character ch is found in more than one index in the String str, the program prints...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT