Need Guidance

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.
Begin by creating a class to hold an account details, with its setter and getter methods
Last edited on
#include <string>
#include <iostream>
using namespace std;








int main()
{
char accnum[9];
char cusname[20];


cout<<"Please enter your account type:\n (S) Saving\n (C) Current\n (T) Trading\n"<<endl;
cin>>accnum[0];

cout<<"Please enter your account Number:"<<endl;

for(int a=1; a<9; a++)
{

cin>>accnum[a];
}


for(int b=0; b<9; b++)
{

cout<<accnum[b];
}

cout<<endl;
cout<<endl;

cout<<"Please enter your name:"<<endl;
cin.getline(cusname,20)>>cusname;

cout<<"Name:"<<cusname<<endl;





system("pause");
return 0;
}




---------------------------------------------------------


somehow the customer name is not displaying the same input being inserted, am i on the wrong track?
I would strongly suggest working with String format (that is in your assignment too), your life would be a bit easier.

Also, I still side with creating a class for this - would be much easier to maintain and perform various operations with it.

@ experts on this forum - please correct me if I'm wrong.

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <string>
using namespace std;

int main()
{
	char cusname[20] = {'\0'};
	cout << "Enter your name: ";
	cin.getline(cusname, 20);
	
	cout << cusname;
	
	cout << endl;

	// if you know strings, just to show the simplicity of strings
	string name;
	
	cout << "Enter name: ";
	cin >> name;
	cout << name;
	
	return 0;
}
	


*forgot closing code tag
Last edited on
#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/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace 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?

When you call a function, don't include the return type. (line 89)

create_acc ();
line 89: You've created a function declaraton, not a function call. Remove the void
Topic archived. No new replies allowed.