design approach

G

Gary Wessle

Hi

I would appricate some help in figuring out how to so this.

I have an unspecified number-of-persons who have access to a joint bank
account. each person is assigned 20 transactions, one person can't
make 2 consecutive transactions, but they take turns, the description
of a transaction "deposit/withdrawal, amount,..." a person makes
depends on the current account status "balance, ..." as well as the
description of the last transaction this person did on the account and
that person status "type of access he has to the account".
I need to keep updated records for each person to help them make the
decision at the time of their transactions.

class persons
{
string name;
string status;
....
};


class transaction
{
string type;
double amount;
public:
transaction(string person_name);
};

class account
{
string status; //over drawn ...etc
double balance;
...
public
account();
};

vector <persons> persons;

for(int i = 0; i < 20; i++){ //for each round of transactions turn
for(int j=0; j < number-of-persons; j++){ //for each person do
transaction (person[j].name);

but how do I keep this transaction in memory for this person as well
as the account updated.


thank you
 
D

Daniel T.

Gary Wessle <[email protected]> said:
Hi

I would appricate some help in figuring out how to so this.

I have an unspecified number-of-persons who have access to a joint bank
account. each person is assigned 20 transactions, one person can't
make 2 consecutive transactions, but they take turns, the description
of a transaction "deposit/withdrawal, amount,..." a person makes
depends on the current account status "balance, ..." as well as the
description of the last transaction this person did on the account and
that person status "type of access he has to the account".
I need to keep updated records for each person to help them make the
decision at the time of their transactions.

class persons
{
string name;
string status;
...
};


class transaction
{
string type;
double amount;
public:
transaction(string person_name);
};

class account
{
string status; //over drawn ...etc
double balance;
...
public
account();
};

vector <persons> persons;

for(int i = 0; i < 20; i++){ //for each round of transactions turn
for(int j=0; j < number-of-persons; j++){ //for each person do
transaction (person[j].name);

but how do I keep this transaction in memory for this person as well
as the account updated.

How about...

person.make_transaction_on( account );
 
V

Victor Bazarov

Gary said:
I would appricate some help in figuring out how to so this.

I have an unspecified number-of-persons who have [..]

This is not a C++ language question. Please post to 'comp.object'
for design advice.

V
 
D

David

Hello Gary,

Hi

I would appricate some help in figuring out how to so this.

I have an unspecified number-of-persons who have access to a joint bank
account. each person is assigned 20 transactions, one person can't
make 2 consecutive transactions, but they take turns, the description
of a transaction "deposit/withdrawal, amount,..." a person makes
depends on the current account status "balance, ..." as well as the
description of the last transaction this person did on the account and
that person status "type of access he has to the account".
I need to keep updated records for each person to help them make the
decision at the time of their transactions.

class persons
{
string name;
string status;
...
};


class transaction
{
string type;
double amount;
public:
transaction(string person_name);
};

class account
{
string status; //over drawn ...etc
double balance;
...
public
account();
};

vector <persons> persons;

for(int i = 0; i < 20; i++){ //for each round of transactions turn
for(int j=0; j < number-of-persons; j++){ //for each person do
transaction (person[j].name);

but how do I keep this transaction in memory for this person as well
as the account updated.

I'm not sure what you are asking here. I presume that you are wanting
to reuse the values of transaction, account, and person later on in
your code. You could make a copy of those values inside your loops
for use later on. It all depends on what your needs are.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,815
Messages
2,569,702
Members
45,492
Latest member
juliuscaesar

Latest Threads

Top