Hi I was making a c++ banking system. But it won't run there some error in it.
Hi I was making a c++ banking system. But it won't run there some error in it.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Hi I was making a c++ banking system. But it won't run there some error in it.
#include <iostream> //Header file for input and output.
#include <iomanip> //This library is used to manipulate streams.
#include <cmath> //For computing mathematical functions
using namespace std;
classBank_of_Arizona
{
private: //Private Class
int account_no, balance_amt;
char name[50], account_type[20];
public: //Public Class
void createAccount() //Public Function to Create an Account
{
cout<<"\n Enter the Account Number: ";
cin>>account_no;
cout<<"\n Enter Account Holder Name: ";
cin>>name;
cout<<"\n Enter type of Account from Savings Account /Fixed Account: ";
cin>>account_type;
cout<<"\n Enter Balance (If you are creating a new account Enter 0): ";
cin>>balance_amt;
}
void viewAccount() //Public Function to View the Details of the Account
{
cout<<"\n Account Number: ";
cout<<account_no;
cout<<"\n Account Holder Name: ";
cout<<name;
cout<<"\n Type of Account: ";
cout<<account_type;
cout<<"\n Your Current Balance: ";
cout<<balance_amt;
}
void depositAmount() //Public Function to Deposit Money to Account
{
int amt;
cout<<"\n Enter the amount that you want to Deposit to your Account: ";
cin>>amt;
balance_amt=balance_amt+amt;
cout<<"\n Thank you the amount has been deposited ";
}
void withdrawAmount() //Public Function to Withdraw Money from Account
{
int amt;
cout<<"\n Enter the amount that you want to Withdraw: ";
cin>>amt;
if (amt<=balance_amt)
{
balance_amt=balance_amt-amt;
cout<<"\n Amount Withdrawn! Balance amount= "<<balance_amt;
}
else
cout<<"\n The above Entered amount "<<amt<<" is not present in your account"<<"\n Your current balance is "<<balance_amt;
}
int Account(int);
};
int Bank_of_Arizona :: Account(int n) //Search Account from Record
{
if(account_no==n)
{
viewAccount();
return 1;
}
return 0;
}
int main() //Main Function
{
int x, amt;
char ch, opt;
Bank_of_Arizona B[x];
int flag=0, n, i;
cout<<"\n------------------------------------------------------------------------------------------------------------";
cout<<"\n\t\t\t\t\t\t BANK OF ARIZONA";
cout<<"\n------------------------------------------------------------------------------------------------------------";
cout<<"\n\n\t\t WELCOME TO BANK OF ARIZONA";
do{
cout<<"\n Enter number of Accounts to be added to the System:";
cin>>x;
for(i=0;i<x;i++)
{
B[i].createAccount();
}
cout<<"\n Select any one of the option listed below";
cout<<"\n1. Open a new Account";
cout<<"\n2. View the details of your Existing Account";
cout<<"\n3. Deposit money to your Existing Account";
cout<<"\n4. Withdraw money from your Existing Account";
cout<<"\n5. Exit";
cout<<"\n\t Please choose any option from 1-5:\t";
cin>>ch;
switch(ch)
{
case '1':
for(i=0;i<=x;i++)
{
B[i].createAccount();
}
break;
case '2':
for(i=0;i<=x;i++)
{
B[i].viewAccount();
}
break;
case '3':
cout<<"\n Enter the Account Number to which the Amount has to be Deposited: ";
cin>>n;
for(i=0;i<=x;i++)
{
flag=B[i].Account(n);
if(flag)
{
B[i].depositAmount();
break;
}
}
if(!flag)
{
cout<<"\n Invalid Account (or) No such account number exist in our bank";
}
break;
case '4':
cout<<"\n Enter the Account Number to which the Amount has to be Withdrawn:";
cin>>n;
for(i=0;i<x;i++)
{
flag=B[i].Account(n);
if(flag)
{
B[i].withdrawAmount();
break;
arrow_forward
}
}
if(!flag)
{
cout<<"\n Invalid Account (or) No such account number exist in our bank";
}
break;
case '4':
cout<<"\n Enter the Account Number to which the Amount has to be Withdrawn:";
cin>>n;
for(i=0;i<x;i++)
{
flag=B[i].Account(n);
if(flag)
{
B[i].withdrawAmount();
break;
}
}
if(!flag)
{
cout<<"\n Invalid Account (or) No such account number exist in our bank";
}
break;
case '5':
cout<<"\n THANK YOU FOR VISITING OUR BANK";
break;
default:
cout<<"\n Wrong Option";
}
cout<<"\n Do you want view more Employee Details ? (y/n).. ";
cin>>opt;
}
while(opt=='y' || opt=='Y');
return 0;
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY