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...
Create a Java class file for an Account class. In the File menu select New File......
Create a Java class file for an Account class. In the File menu select New File... Under Categories: make sure that Java is selected. Under File Types: make sure that Java Class is selected. Click Next. For Class Name: type Account. For Package: select csci1011.lab8. Click Finish. A text editor window should pop up with the following source code (except with your actual name): csci1011.lab8; /** * * @author Your Name */ public class Account { } Implement the Account...
C Program: Create a C program that prints a menu and takes user choices as input....
C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. The specifications must be followed exactly, or else the input given in the script file may not match with the expected output. Important! Consider which control structures will work best for which aspect of the assignment. For example, which would be the best to use for a menu?...
C Program: Create a C program that prints a menu and takes user choices as input....
C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. The specifications must be followed exactly, or else the input given in the script file may not match with the expected output. Your code must contain at least one of all of the following control types: nested for() loops a while() or a do-while() loop a switch() statement...
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...
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...
Create a Java program. The class name for the program should be 'EncryptText'. In the main...
Create a Java program. The class name for the program should be 'EncryptText'. In the main method you should perform the following: You should read a string from the keyboard using the Scanner class object. You should then encrypt the text by reading each character from the string and adding 1 to the character resulting in a shift of the letter entered. You should output the string entered and the resulting encrypted string. Pseudo flowchart for additional code to be...
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....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT