banking system :

-all the bank accout can be created, accessed,and clossed later.
-three type of account:current,saving,fixed deposit.
-each custormer can open more than one type of accounts.
-The transactions are deposit, withdraw, and view balance
-the account created with a deposit and creation date.
-After that money can be deposited and withdrawn.Balance will be updated accordingly
-a request for balande should display each individual account ballance as well as the total balance of all acoounts owned

customer class and an account class

customer class:

customer no (3 digits)
Name
address
account class:

creation date
Balance
type

This isn't a homework project, is it?

Have you done anything on the code yet? If so, please post what you've done so far.

We don't do your homework here for you. If you don't show effort on your part, this post might get closed/deleted.

yes, this is my C++ assignment.
i know this assignment want to using the Object-Oriented concepts(inheritance, polymorphism etc).
i know to defind some classes like create account, and what type of acount custermer want to create, but i dont know how to search back the account custemer created.

Like I said, if this is an assignment, work on it some yourself, and if you get stuck, post the code you've written so far, and ask if we can help troubleshoot your already written code.

We don't do your homework for you-- we help you figure out your problems. Many of us here (not including me, though) are excellent programmers, but we're not willing to help unless you're willing to help yourself first.

ok, i just recieve this project in one week later, i will try to write somthing if i have stuck, i will post the code.

#include "stdafx.h"
#include <iostream.h>
#include <conio.h>
#include <windows.h>

struct accounts{
int acnum1;
int acnum2;
int acnum3;
double balance1;
double balance2;
double balance3;
};

typedef struct accounts account;


account init (account);
account deposit (account);
account withdraw (account);
void query (account);
void showall (account);


int main(int argc, char* argv[])
{
account bank;
bank = init (bank);
char transaction;
while (transaction != 'E'){
cout<<"\n++++++++++\n";
cout<<"WORLD BANK\n";
cout<<"\n++++++++++\n\n";

cout<<"deposit -----> <press> D\n";
cout<<"withdraw -----> <press> W\n";
cout<<"Query -----> <press> Q\n";
cout<<"Show All -----> <press> S\n";
cout<<"Exit -----> <press> E\n";
cout<<"\n\n";

cout<<"please select your transaction :";
cin>>transaction;

switch(transaction){
case 'D':
bank = deposit(bank);
break;
case 'W':
bank = withdraw(bank);
break;
case 'Q':
query(bank);
break;
case 'S':
showall(bank);
break;
case 'E' || 'e':
exit(0);
break;
default:
"please select one of the items from the menu item";
break;

}
system("CLS");
}
return 0;
}

account init (account buffer){
buffer.acnum1 = 11111;
buffer.acnum2 = 22222;
buffer.acnum3 = 33333;
buffer.balance1 = 0;
buffer.balance2 = 0;
buffer.balance3 = 0;
return buffer;
}

account deposit (account bank){
int ac_num;
double balance,deposit_amt;

cout<<"\nenter account number";
cin>>ac_num;
switch(ac_num){
case 11111:
cout<< "enter deposit amount ";
cin>>deposit_amt;
bank.balance1 = bank.balance1 + deposit_amt;
balance = bank.balance1;
system("CLS");
cout<<"TRANSACTION APPROVED";
cout<<"\n++++++++++++++++++++++\n\n\n\n";
cout<<"Balance on your account :\n"<<"#"<<ac_num<<" is $"<<balance;
cout<<"\n\n\npresss ne button to continue";
cout<<endl;
getch();
break;
case 22222:
cout<< "enter deposit amount ";
cin>>deposit_amt;
bank.balance2 = deposit_amt + bank.balance2;
balance = bank.balance2;
system("CLS");
cout<<"TRANSACTION APPROVED";
cout<<"\n++++++++++++++++++++++\n\n\n\n";
cout<<"Balance on your account :\n"<<"#"<<ac_num<<" is $"<<balance;
cout<<"\n\n\npresss ne button to continue";
cout<<endl;
getch();
break;
case 33333:
cout<< "enter deposit amount ";
cin>>deposit_amt;
bank.balance3 = deposit_amt + bank.balance3;
balance = bank.balance3;
system("CLS");
cout<<"TRANSACTION APPROVED";
cout<<"\n++++++++++++++++++++++\n\n\n\n";
cout<<"Balance on your account :\n"<<"#"<<ac_num<<" is $"<<balance<<".00";
cout<<"\n\n\npresss ne button to continue";
cout<<endl;
getch();
break;
default:
cout<<"acount number does not exist";
break;
}

return bank;
}



account withdraw (account bank){
int ac_num;
double balance,withdrawl_amt;

cout<<"\nenter account number";
cin>>ac_num;
switch(ac_num){
case 11111:
cout<< "enter withdrawl amount ";
cin>>withdrawl_amt;
bank.balance1 = bank.balance1 - withdrawl_amt;
balance = bank.balance1;
system("CLS");
cout<<"TRANSACTION APPROVED";
cout<<"\n++++++++++++++++++++++\n\n\n\n";
cout<<"Balance on your account :\n"<<"#"<<ac_num<<" is $"<<balance;
cout<<"\n\n\npresss ne button to continue";
cout<<endl;
getch();
break;
case 22222:
cout<< "enter withdrawl amount ";
cin>>withdrawl_amt;
bank.balance2 = bank.balance2 - withdrawl_amt;
balance = bank.balance2;
system("CLS");
cout<<"TRANSACTION APPROVED";
cout<<"\n++++++++++++++++++++++\n\n\n\n";
cout<<"Balance on your account :\n"<<"#"<<ac_num<<" is $"<<balance;
cout<<"\n\n\npresss ne button to continue";
cout<<endl;
getch();
break;
case 33333:
cout<< "enter withdrawl amount ";
cin>>withdrawl_amt;
bank.balance3 = bank.balance3 - withdrawl_amt;
balance = bank.balance3;
system("CLS");
cout<<"TRANSACTION APPROVED";
cout<<"\n++++++++++++++++++++++\n\n\n\n";
cout<<"Balance on your account :\n"<<"#"<<ac_num<<" is $"<<balance<<".00";
cout<<"\n\n\npresss ne button to continue";
cout<<endl;
getch();
break;
default:
cout<<"acount number does not exist";
break;
}

return bank;
}

void query (account bank){
int ac_num;
cout<<"\nenter account number";
cin>>ac_num;
switch(ac_num){
case 11111:
system("CLS");
cout<<"TRANSACTION APPROVED";
cout<<"\n++++++++++++++++++++++\n\n\n\n";
cout<<"Balance on your account :\n"<<"#"<<ac_num<<" is $"<<bank.balance1;
cout<<"\n\n\npresss ne button to continue";
cout<<endl;
getch();
break;
case 22222:
system("CLS");
cout<<"TRANSACTION APPROVED";
cout<<"\n++++++++++++++++++++++\n\n\n\n";
cout<<"Balance on your account :\n"<<"#"<<ac_num<<" is $"<<bank.balance2;
cout<<"\n\n\npresss ne button to continue";
cout<<endl;
getch();
break;
case 33333:
system("CLS");
cout<<"TRANSACTION APPROVED";
cout<<"\n++++++++++++++++++++++\n\n\n\n";
cout<<"Balance on your account :\n"<<"#"<<ac_num<<" is $"<<bank.balance3<<".00";
cout<<"\n\n\npresss ne button to continue";
cout<<endl;
getch();
break;
default:
cout<<"acount number does not exist";
break;
}

}

void showall (account bank){
system("CLS");
cout<<"DISPLAYING ALL EXISTING ACCOUNTS";
cout<<"\n++++++++++++++++++++++++++++++\n";
cout<<"ACCOUNT\t\t\t\tBALANCE\n\n\n";
cout<<"-------\t\t\t\t-------\n";
cout<<bank.acnum1<<"\t\t\t\t"<<bank.balance1<<"\n";
cout<<bank.acnum2<<"\t\t\t\t"<<bank.balance2<<"\n";
cout<<bank.acnum3<<"\t\t\t\t"<<bank.balance3<<"\n";
cout<<"\n\n\npress ne key to continue";
cout<<endl;
getch();
}

this is a suck code
i hated it
kill it:icon_mad:

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.