bank account system

can anyone help me with this question...

Design a class named ‘Account’ to represent a simple bank account. The class should hold the following:-
• Fields/attributes – first name, last name, account number, balance.
• Constructors to create an Account object either with a given starting balance or an unknown starting balance in which it should be set to 0.0.
• Methods:
o all ‘getter’ & ‘setter’ methods;
o getFullName method that will return the full name of account holder.
o display method to print out the details of an Account object;
o withdraw method & deposit method – which will subtract or add an amount from the balance and output a string containing the revised balance.

Design a new class named ‘CurrentAccount’ that derives from ‘Account’ to represent a current account. The class should hold the following additions/changes:-
• Field/attribute – overdraft limit.
• Constructors to create a CurrentAccount object either with a given overdraft limit or an unknown overdraft limit in which it should be set to 0.0.
• Methods:
o ‘getter’ & ‘setter’ methods for overdraft limit;
o display method to print out the details of a CurrentAccount object;
o withdraw method – which will subtract an amount from the balance and output a string containing the revised balance. Your program should allow the withdraw method reduce a balance below zero only if the resulting balance is greater or equal to the overdraft limit. If not, an appropriate message should be output.

Design a new class named ‘SavingAccount’ that derives from ‘Account’ to represent a saving account. The class should hold the following changes:-
• Constructors to create a SavingAccount object.
• Methods:
o withdraw method – which will subtract an amount from the balance and output a string containing the revised balance. Your program should NOT allow the withdraw method reduce a balance below zero. Show an appropriate message if the case happened.


Develop a program that includes all the classes.

In main method, creates an array of 50 current accounts and another array of 50 saving accounts.

Your program should provide the functions such as:
1. Allow user to create a new current account / saving account
2. Withdraw / deposit from an account
3. Print the details of an account
4. Print the details of all accounts
And what the question is?
All I see is your assigment.

What do you have now?
What ideas do you have?
Which problems have you encountered?
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
110
111
112
113
114
#include <iostream>
#include <string>
using namespace std;

class Account{
	private:
		string firstname;
		string lastname;
		string FullName;
		int accountnumber;
		double balance;
	public:
		Account(){
			firstname = "Raaj";
			lastname = "Lokanathan";
			FullName = "Raaj Lokanathan";
			accountnumber = 5671;
			balance = 0.0;
		}
		Account(string fName,string lName,int accno,double bal);
		void setFullName(string fullname);
		void setaccountnumber(int accno);
		void setbalance(double bal);
		void setwithdraw(int wdraw);
		void setdeposit(int dep);
		string getFullName();
		int getaccountnumber();
		double getbalance();
		void display();

};

Account::Account(string fName,string lName,int accno,double bal){
	firstname = fName;
	lastname = lName;
	accountnumber = accno;
	balance = bal;
}

void Account::setFullName(string fullname){
	FullName = fullname;
}

void Account::setaccountnumber(int accno){
	accountnumber = accno;
}

void Account::setbalance(double bal){
	balance = bal;
}

void Account::setwithdraw(int wdraw){
	wdraw=balance-wdraw;
}

void Account::setdeposit(int dep){
	dep=dep+balance;
}

string Account::getFullName(){
	return FullName;
}

int Account::getaccountnumber(){
	return accountnumber;
}

double Account::getbalance(){
	return balance;
}

void Account::display(){
	cout<<"First Name: "<<firstname<<endl;
	cout<<"Last Name: "<<lastname<<endl;
	cout<<"Account Number: "<<accountnumber<<endl;
	cout<<"Current Balance: "<<balance<<endl;
}

int main(){
	Account Acc;
	Acc.setFullName("Raaj Lokanathan");
	Acc.setaccountnumber(5671);
	Acc.setbalance(0.0);
	Acc.display();
	Account acc[50];
	string full_name;
	int acc_no;
	double bAl;
	int i;
	for(i=0;i<50;i++){
		cout<<"Please enter the details for the customer: "<<i+1<<endl;
		cout<<"Please enter your full name: ";
		getline(cin,full_name);
		cout<<"Please enter your account number: ";
		cin>>acc_no;
		cout<<"Please enter your current balance: ";
		cin>>bAl;
		acc[i].setFullName(full_name);
		acc[i].setaccountnumber(acc_no);
		acc[i].setbalance(bAl);
	}
	for(i=0;i<50;i++){
		cout<<"Detail for the bank customers"<<i+1<<endl;
		acc[i].display();
	}

	system("pause");

	return 0;

}



this is what i have done for now..
yeah it works..thanks
Topic archived. No new replies allowed.