Beginner need help

This is a work in progress for an assignment. I am doing it step by step and I am kind of stuck at this point.

If I comment out any RecordDeposit RecordWithdrawal CreateTransaction it runs without a problem but I need to put the info there to retrieve...


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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135


#include <iostream>
#include <iomanip>
#include <string>
#include <conio.h>
#include <stdio.h>

using namespace std;

#include "Header.h"
#include "Trans.h"
#include "Account.h"
#include "Source.h"


Customer* CreateCustomer(const string& name,
	const string& userID, const string& pin)
{
	Customer *customer = new Customer;

	customer->userID = userID;
	customer->name = name;
	customer->pin = pin;



	return customer;
}


Account* CreateAccount(Customer *customer,
	const string &AccNum,
	const string &AccDate,
	const int &balance = 0,
	const int &total_deposit = 0,
	const int &total_withdrawal = 0,
	const int &transx = 0)
{
	Account *acc = new Account;
	acc->Customer = customer;
	acc->number = AccNum;
	acc->date = AccDate;
	acc->balance = balance;
	acc->total_deposit = total_deposit;
	acc->total_withdrawal = total_withdrawal;
//	acc->transx;


	return acc;
}



Transaction* CreateTransaction(Account *Customer,
	const string& TransDate,
	const string &TransDescription,
	const double &TransAmount)
{
	Transaction *transx = new Transaction;

	transx->Account = Customer;
	transx->TransDate = TransDate;
	transx->TransDescription = TransDescription;
	transx->TransAmount = TransAmount;

	return transx;
}

Transaction* RecordDeposit(Account *Customer,
	const string& TransDate,
	const string &TransDescription,
	const double &TransAmount)
{
	Transaction *recordDeposit = new Transaction;

	recordDeposit->Account = Customer;
	recordDeposit->TransDate = TransDate;
	recordDeposit->TransDescription = TransDescription;
	recordDeposit->TransAmount += TransAmount;
	return recordDeposit;
}
Transaction* RecordWithdraw(const string& TransDate,
	const string &TransDescription,
	const double &TransAmount)
{
	Transaction *recordwithdrawal = new Transaction;

	recordwithdrawal->TransDate = TransDate;
	recordwithdrawal->TransDescription = TransDescription;
	recordwithdrawal->TransAmount -= TransAmount;
	return recordwithdrawal;
}



int main()
{
	Customer* Mary = CreateCustomer("Mary Jones", "235718", "5074");
	Customer* John = CreateCustomer("John Smith", "375864", "3251");
	

	Account* MaryAccount = CreateAccount(Mary, "06-3121-10212357", "01/03/2014", 100);
	Account* JohnAccount = CreateAccount(John, "06-3121-10213758", "10/03/2014");


	Transaction* RecordDeposit = CreateTransaction (MaryAccount, "02/03/2014", "Deposit", 90);
	Transaction* RecordWithdraw = CreateTransaction(MaryAccount, "04/03/2014", "ATM Withdrawal", 150);
	//RecordWithdraw  (MaryAccount("01/03/2014", "ATM Withdrawal", 50));
//	RecordDeposit(MaryAccount, CreateTransaction("02/03/2014", "Deposit", 90);
	//RecordWithdraw(MaryAccount, CreateTransaction("04/03/2014", "ATM Withdrawal", 150));
	//RecordDeposit(MaryAccount, CreateTransaction("05/03/2014", "Deposit", 20));
	//RecordWithdraw(MaryAccount, CreateTransaction("05/03/2014", "Withdraw", 100));
	//RecordWithdraw(MaryAccount, CreateTransaction("05/03/2014", "Withdraw", 50));
	
	/*
	RecordDeposit(JohnAccount, CreateTransaction("11/03/2014", "Deposit", 20)); 
	RecordDeposit(JohnAccount, CreateTransaction("12/03/2014", "Deposit", 80)); 
	RecordWithdraw(JohnAccount, CreateTransaction("12/03/2014", "Withdraw", 50));

	*/

	
	printReport(MaryAccount);
	printReport(JohnAccount);

	
	_getch();
	return 0;
}







-/-/-/-/-/-/ Account.h -/-/-/-/-/-/
#ifndef ACCOUNT_H
#define ACCOUNT_H
#pragma once

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

//#include "Header.h"
//#include "Trans.h"
//#include "Account.h"
struct Account
{
Customer *Customer;
string number;
string date;
int balance;
int total_deposit;
int total_withdrawal;
//Transaction transx[100];

};


void DisplayLine()
{
for (int i = 0; i < 65; i++) cout << "+";
cout << "\n";
}

void printReport(Account* acc)
{

cout << "ACCOUNT SUMMARY : \t" << acc->number << " - " << acc->Customer->name << std::endl;
cout << "Total Deposits : \t" << acc->total_deposit << std::endl;
cout << "Total Withdrawal : \t" << acc->total_withdrawal << std::endl;
cout << "Final Balance : \t" << acc->balance << std::endl;
double bal = 0;
cout << "DATE" << "\t\t" << "DESCRIPTION" << "\t\t" << "DEPOSIT" << "\t\t" << "WITHDRAWAL" << "\t" << "BALANCE" << std::endl;
cout << "------------------------------------------------------------------------------" << std::endl;




}


#endif ACCOUNT_H


-/-/-/-/-/-/ Header.h -/-/-/-/-/-/

#pragma once

#ifndef HEADER_H
#define HEADER_H

using namespace std;
#include <iostream>
#include <iomanip>
#include <string>



struct Customer
{
string name;
string userID;
string pin;

};



#endif HEADER_H


-/-/-/-/-/-/ Trans.h -/-/-/-/-/-/
#ifndef TRANS_H
#define TRANS_H

#include <iostream>
#include <iomanip>
#include <string>


using namespace std;

#include "Account.h"


struct Transaction
{
Account *Customer;
//string AccountName;
string TransDate;
string TransDescription;
double TransAmount;

};




#endif TRANS_H



I will try to provide more information if required,
Cheers.

Error C2039 'Account': is not a member of 'Transaction' Customer action d:\visual studio 2015\customer action\customer action\source.cpp 61

Error C2039 'Account': is not a member of 'Transaction' Customer action d:\visual studio 2015\customer action\customer action\source.cpp 77

is the current error that I am getting when I compiled it.
Topic archived. No new replies allowed.