Account Management System In this project, you will write a program to manage a
ID: 3823002 • Letter: A
Question
Account Management System In this project, you will write a program to manage a bank account and a stock portfolio. The program will be written using inheritance structure for the classes. Starting with the abstract base class Account write two derived classes stockAccount and bankAccount. All of the accounts should be linked together through the common cashBalance variable. The starting balance for the account will be $10000. The balance will change as you perform the transactions. In the main menu, you can select to work with either stock account, bank account, or exit the program. The sub menu for each will be as following Stock account Display current price for a stock symbol Buy stock Sell stock Display current portfolio Display transactions history Return to main menu Bank account: Display current cash balance Deposit to account Withdraw from account Display transactions history Return to main menuExplanation / Answer
#include<iostream>
#include<string.h>
#include<process.h>
using namespace std;
class bank //this is a class to store the acc. information
{
char fir_name[100];
char last_name[100];
public:
static int accno;
long balance;
//details d;
void delete_acc();
void deposit();
void withdrawal();
void newaccount();
void inspection();
};
int bank::accno=0;
int main()
{
char ch;
static int i=0;
bank *a[10]; //list of accounts is declared
int x,amt,k;
//clrscr();
do
{
cout<<endl<<endl<<"************MENU************"<<endl;
cout<<" ---- "<<endl;
cout<<"1.Create new account 2.Deposit 3.Withdraw 4.Delete Account 5.Sort Accounts ";
cout<<"Enter choice no.: ";
cin>>x;
switch(x)
{
case 1:
{
i++;
a[i]=new bank;
a[i]->newaccount(); //calling the function to create new acc.
break;
}
case 2:
{
cout<<"Enter account no.: ";
cin>>k;
a[k]->deposit();
break;
}
case 3:
{
cout<<"Enter account no.: ";
cin>>k;
a[k]->withdrawal();
break;
}
case 4:
{
cout<<"Enter the Acc. no. you want to delete"<<endl;
cin>>k;
//delete a[k];
a[k]->delete_acc();
//cout<<"Your Acc. has been deleted"<<endl;
break;
}
case 5:
{
cout<<"Enter account no.: ";
cin>>k;
a[k]->inspection();
break;
}
}cout<<" Do you wish to continue[Press 'Y' to continue or 'N' to exit menu]: ";
cin>>ch;
}while(ch=='y'||ch=='Y');
return 0;
}
void bank::delete_acc() //delete the particular acc.
{
balance = 0;
accno = 0;
}
void bank::withdrawal()
{
long amtdrawn;
cout<<"Enter amount to be withdrawn: ";
cin>>amtdrawn;
if(balance<amtdrawn) //check whether the balance is enough to withdraw
cout<<" Insufficient balance! Operation Cannot be performed!"<<endl<<endl;
else
balance=balance-amtdrawn;
cout<<"Your current balance is "<<balance<<endl;
}
void bank::deposit() //this fuc. deposit some amount to particular acc, no.
{
long dep;
cout<<"Enter amount to be deposited: ";
cin>>dep;
balance+=dep;
cout<<"Your current balance is "<<balance<<endl;
}
void bank::newaccount()
{
accno++;
cout<<"Enter your first name"<<endl;
cin>>fir_name;
cout<<"Enter your last name"<<endl;
cin>>last_name;
//d.getdetails();
balance=0;
cout<<"Your Account has been created and Acc. No. is:"<<accno<<endl;
}
void bank::inspection() // this function is used for inspection about particular acc.
{
cout<<endl<<endl<<"*********BANK ACCOUNT DETAILS*********"<<endl;
cout<<" --- ---- ------- ------- "<<endl;
cout<<"Account no.: "<<accno<<endl;
cout<<"Name: "<<fir_name<<endl;
cout<<"Name: "<<last_name<<endl;
cout<<"Current Balance: "<<balance<<endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.