Ihave been given project on C++ i.e on banking. system can u give me coding of t
ID: 3540023 • Letter: I
Question
Ihave been given project on C++ i.e on banking. systemcan u give me coding of this project. plz help help I will rate your answer I will truly appreciate that you help me solve this one; here is the code below. I need the code whenever it says "TO DO". Thanks in advance :-) #ifndef _BANKINGSYSTEM_CPP #define _BANKINGSYSTEM_CPP #include #include #include #include "bankingSystem.h" void Account::SetAccountID(unsigned accountID) { accountID_ = accountID; } unsigned Account::GetAccountID() { return accountID_; } //*** TO DO: Add the rest of your Account function implementations here. //Default constructor just initializes //current number of accounts to 0; BankingSystem::BankingSystem() : current_num_accounts_(0) {} //Find an account by accountID. //Return the array index if found, current_num_accounts_ otherwise. size_t BankingSystem::FindAccount(size_t accountID) { for (size_t i = 0; i < current_num_accounts_; ++i) if (accounts_[i].GetAccountID() == accountID) return i; return current_num_accounts_; } //Match the passcode at a given index with the given passcode. //Return true for a match, false otherwise. bool BankingSystem::MatchPasscode(unsigned passcode, size_t index) { return accounts_[index].GetPasscode() == passcode; } //Add an account. void BankingSystem::CreateAccount() { Account account; unsigned accountID; unsigned passcode; std::string firstName; std::string lastName; double balance; //Get the account ID and make sure it doesn't already exist. std::cout << " Enter the account ID: "; std::cin >> accountID; if (FindAccount(accountID) != current_num_accounts_) { std::cout << " Account already exists! "; return; } std::cout //*** TO DO: Get the remaining items (passcode, first name, last name, balance). //Set this info into your Account object. account.SetAccountID(accountID); account.SetPasscode(passcode); account.SetFirstName(firstName); account.SetLastName(lastName); account.SetBalance(balance); //Add the account to your array and increment the count of accounts. accounts_[current_num_accounts_] = account; ++current_num_accounts_; std::cout << " Account added successfully! "; } //Delete an account. void BankingSystem::DeleteAccount() { size_t index; unsigned accountID; unsigned passcode; //*** TO DO: Get the account ID and verify it exists. //*** TO DO: Get the passcode and verify it matches. //Remove the account. First, shift everything over to the left. for (size_t i = index; i < current_num_accounts_ - 1; ++i) accounts_[i] = accounts_[i + 1]; //Then, decrement the count of accounts. --current_num_accounts_; std::cout << " Account erased! "; } //*** TO DO: Add your remaining BankingSystem function implementations here. #endif bankingSystemDriver.cpp /* COP 3014 Summer 2013 Project 2 bankingSystemDriver.cpp (partial code) */ #include #include "bankingSystem.h" //Print a menu of options to the user. void PrintMenu() { std::cout << " (1) Add Account "; std::cout << "(2) Delete Account "; std::cout << "(3) Print Accounts "; std::cout << "(4) Deposit "; std::cout << "(5) Withdrawal "; std::cout << "(6) Exit "; std::cout << " Enter selection: "; } //Start your main program loop here. int main() { //All class functions are called through a BankingSystem object. BankingSystem b; int selection; std::cout << " *** Welcome to the Banking System *** "; do { std::cout << " (1) Add Account "; std::cout << "(2) Delete Account "; std::cout << "(3) Print Accounts "; std::cout << "(4) Deposit "; std::cout << "(5) Withdrawal "; std::cout << "(6) Exit "; std::cout << " Enter selection:"; std::cin >> selection ; } while((selection > 0) && (selection < 7) ); return 0; } bankingSystem.h /* COP 3014 Summer 2013 Project 2 bankingSystem.h */ #ifndef _BANKINGSYSTEM_H #define _BANKINGSYSTEM_H #include #include #include //Class Account holds an account ID, passcode, //first name, last name, and balance. All variables //are kept private. Access/changes are made through //public set and get functions. class Account { public: void SetAccountID(unsigned accountID); unsigned GetAccountID(); void SetPasscode(unsigned passcode); unsigned GetPasscode(); void SetFirstName(const std::string& firstName); std::string GetFirstName(); void SetLastName(const std::string& lastName); std::string GetLastName(); void SetBalance(double balance); double GetBalance(); private: unsigned accountID_; unsigned passcode_; std::string firstName_; std::string lastName_; double balance_; }; //Assume a max of 100 accounts. const size_t MAX_NUM_ACCOUNTS = 100; //Class BankingSystem uses an array of Account. //You can create, delete, print, deposit, and withdraw. class BankingSystem { public: BankingSystem(); void CreateAccount(); void DeleteAccount(); void PrintAccounts(); void Deposit(); void Withdraw(); private: Account accounts_[MAX_NUM_ACCOUNTS]; size_t current_num_accounts_; //Use these auxiliary functions if you want. //See bankingSystem.cpp for more info. size_t FindAccount(unsigned accountID); bool MatchPasscode(unsigned passcode, size_t index); }; #endif Ihave been given project on C++ i.e on banking. system
can u give me coding of this project. plz help help I will rate your answer
Explanation / Answer
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
using namespace std;
class bank {
int ac;
static int reset;
float balance, amount, shorta;
public:
void deposit();
void withdraw();
void chkbalance();
int menu();
};
int bank::reset=0;
void bank::deposit() {
cout<<" Enter Account Number:";
cin>>ac;
if(ac==1001)
{
cout<<" Enter Amount you want to Deposit:";
cin>>amount;
balance=balance+amount;
cout<<" Message: You have successfully deposited Rs."<<amount<<" into your account. Your Current Balance is:"<<balance<<" ";
reset++;
}
else
{
cout<<"You have entered invalid account number";
}
}
void bank::withdraw() {
cout<<"Enter Account Number:";
cin>>ac;
if(ac==1001)
{
cout<<"Enter Amount you want to Withdraw:";
cin>>amount;
if(amount>balance)
{
shorta=amount-balance;
cout<<" You cannot withdraw Rs."<<amount<<" as your account balance is Rs."<<balance<<" You are short of Rs."<<shorta;
}
else
{
balance=balance-amount;
cout<<"You have Withdrawn Rs."<<amount<<" Successfully Your account balance is:"<<balance<<" ";
}
}
else
{
cout<<"You have entered invalid account number";
}
}
void bank::chkbalance() {
cout<<"Enter Account Number:";
cin>>ac;
if(reset==0)
{
balance=0;
}
if(ac==1001)
{
cout<<"Your Account balance is Rs."<<balance<<" ";
}
else
{
cout<<"Account Doesn't Exist!!";
}
}
int main()
{
bank ob;
int ch;
//clrscr();
system("cls");
do {
cout<<" 1.Deposit 2.Withdraw 3.Balance Enquiry 4.Exit ";
ch=ob.menu();
switch(ch)
{
case 1:ob.deposit();
break;
case 2:ob.withdraw();
break;
case 3:ob.chkbalance();
break;
case 4: exit(1);
default:cout<<"Invalid Choice!!";
}
}while(1);
system("pause");
return 0;
}
int bank::menu()
{
int ch;
cout<<" Enter your Choice:";
cin>>ch;
return ch;
}