Title: Bank Account System
Description:
You are required to write a program for a bank account system. In the system you need to
maintain the bank customers’ account. Each bank account contains the following details:
• Bank Account Number
• Customer Name
• Customer Identity Card number (IC No.)
• Type of bank account (Savings Account, Current Account and Trading Account)
• Date of account opening
• Balance of the account
The Bank Account Number is in the format of T######## - whereby T represents the type of
account code (S for Savings, C for Current and T for Trading) and # is a digit. All the
accounts contain 8 digit numbers. Example of the account format – S34568888 and
T11112222.
The Customer name generally is in String format and the name shall be able to support the
format of Malaysians’ name like (Lim Ah Moi,
Ranjit Singh, Badrul Hisham bin Ali…etc.)
The Customer Identity Card Number format is in YYMMDD-BP-#### (YY – Year eg. 89,
MM – Month eg. 11 and DD- Date eg. 29 and # is a digit number. BP – is for a 2 digit code
to represent the Birth Place of the IC holder. Lastly #### is the 4 digit numbers).
Date of Account opening denotes when was the account created and the format of the date is
DD-MM-YYYY (eg. 29-09-2012).
Balance of the account denotes the balance in RM that the customer owns.
You are required to create menu and operations for:
1) Create new bank account
2) Edit existing account holder details (Name and IC. No.)
3) Deposit money to an account
4) Withdraw money from an account
5) Check Balance
6) Close an account
In addition, each member of your assignment group is expected to propose one additional
operation that can be performed by the system. If you have 3 members, then your group
program needs to have 3 additional operations to be added on top of the existing 6 operations.
You are expected to use array structure and also file to store and retrieve data.
I was given this question as an assignment, sadly i can't understand much about the question, after reading through it, i do not really understand it.
What i do know is that function and array is needed.
But i don't know how to start or in what way i can do it.
can't help but feel desperation.
Would like a guidance on how or steps it should be done, or some steps where i should begin with.
I'm a slow learner and i apologize for my poor english.
I always believe you should approach all help as just starting out unless they state otherwise. If this is for homework, then his class may not have covered strings or classes yet.
#include <iostream>
#include <string>
using namespace std;
void cre_acc ()
{
char accnum[9];
int length;
cout<<"Please enter your account type:\n (S) Saving\n (C) Current\n (T) Trading\n"<<endl;
cin>>accnum[0];
accnum[0] = toupper(accnum[0]);
cout<<"Please enter your account Number (8-digits):";
for(int a=1; a<9; a++)
{
cin>>accnum[a];
}
for(int b=0; b<9; b++)
{
cout<<accnum[b];
}
char cusname[20];
cout << "Please enter your name: ";
cin.getline(cusname, 20);
length = strlen(cusname);
for(int a = 0; a < length; a++)
cusname[a] = toupper(cusname[a]);
cout<<"Name:"<<cusname<<endl;
string ic_num;
cout<<"Please enter your identity card number in the format of YYMMDD-BG-####:";
cin>>ic_num;
cout<<ic_num<<endl;
}
int main()
{
system("pause");
return 0;
}
----------------------------------------------------------------
I've made some progress, but i am not sure if i am correct.
About the classes, my lecturer have not teach us 'class' yet, and he explained that we are not required to use class in this assignment , it is optional
You have a start on creating an account. So far, you are getting the account number (and type) and customer name. You need to extend what you have to also ask for identity card, opening date and balance.
You also need to create a menu in main that asks the user what they want to do. create_account is just one of the functions that the user can do.
You also need to think about what you're going to do with the information once you collect it from the users inside create_account. Currently, you are collecting the information into local variables that go out of scope when you exit create_account. You probably want to create a global array of structs (or class instances) to contain account information.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
usingnamespace std;
void create_acc ()
{
char accnum[9];
int length;
cout<<"Please enter your account type:\n (S) Saving\n (C) Current\n (T) Trading\n"<<endl;
cin>>accnum[0];
accnum[0] = toupper(accnum[0]);
cout<<"Please enter your account Number (8-digits):";
for(int a=1; a<9; a++)
{
cin>>accnum[a];
}
for(int b=0; b<9; b++)
{
cout<<accnum[b];
}
char cusname[20];
cout << "Please enter your name: ";
cin.getline(cusname, 20);
length = strlen(cusname);
for(int a = 0; a < length; a++)
cusname[a] = toupper(cusname[a]);
cout<<"Name:"<<cusname<<endl;
string ic_num;
cout<<"Please enter your identity card number in the format of YYMMDD-BG-####:";
cin>>ic_num;
cout<<ic_num<<endl;
}
int main()
{
int opt=0;
cout<<"Welcome to Lion Bank System"<<endl;
cout<<"-----------------------------------------------------------------"<<endl;
cout<<"(1) -Create a new bank account "<<endl;
cout<<"(2) -Edit existing account holder details "<<endl;
cout<<"(3) -Deposit money to an account "<<endl;
cout<<"(4) -Whithdraw money from an account "<<endl;
cout<<"(5) -Check balance "<<endl;
cout<<"(6) -Close an account "<<endl;
cout<<endl;
cout<<"Please enter the service that you need:"<<endl;
cin>>opt;
switch(opt)
{
case 1:
void create_acc ();
break;
default:
cout<<"You have entered an invalid option, Please try again"<<endl;
break;
}
system("pause");
return 0;
}
I'm so sorry for not using the code tag, and thank you AbstractionAnon for pointing that out.
Now i've created the main menu, and added in a switch for the user to pick.
When i input 1 into the switch, why won't it bring out the create_acc function?