Class HELP

Pages: 123
So what error messages are you getting when you try to compile this program?

This is what the C++Shell (press the gear to the right of your code) compiler says:

In function 'void outputToFile(std::string, std::string, std::string, float, double, char)':
145:10: error: expected unqualified-id before '.' token
146:10: error: expected unqualified-id before '.' token
166:45: error: 'teamMemberAmmount' was not declared in this scope
171:33: error: 'invoiceTotal' was not declared in this scope
In function 'int main()':
212:8: error: 'class invoice' has no member named 'outputToFile'
212:21: error: 'clientName' was not declared in this scope
212:33: error: 'teamMemberName' was not declared in this scope
212:49: error: 'titleName' was not declared in this scope
212:60: error: 'hoursWorked' was not declared in this scope
212:73: error: 'payRate' was not declared in this scope
212:82: error: 'userResponse' was not declared in this scope

You're really not using the class since neither outputToFile() nor outputToConsole() are class member functions.

So I've modified this program to use class and main in different files but right now I'm getting a error: lnk2019 unresolved external symbol. Here is my three files if anyone can give me an idea on whats wrong

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef AndrewSmithProjectThreeClass_H
#define AndrewSmithProjectThreeClass_H
	
class Invoice
{
	private:
	double tMAmmount;
	double iTotal;
	
	public:
	double getMemAmmount();
	double getMemTotal();
};

#endif 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "AndrewSmithProjectThreeClass.h"

using namespace std; 
	
double AndrewSmithProjectThreeClass :: getMemAmmount(float hWorked , double pRate)
{
	tMAmmount = (hWorked * pRate);
	return tMAmmount;
}

double AndrewSmithProjectThreeClass :: getMemTotal(double tmAmmount)
{
	iTotal = 0;
	iTotal = iTotal + tmAmmount;
	return iTotal;
}


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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include "AndrewSmithProjectThreeClass.h"
using namespace std; 

void output()
{
	string nextLine = "";
	
	ifstream inputFile;
	
	inputFile.open("AndrewSmithProjectThreeInput.txt");
	
	while (getline(inputFile, nextLine))//output the entire file to the prompt
	{
		cout << nextLine << endl;
		
	}	   
}
	
int main()
{
	char titleNameSelection;	
	char userResponse;
	string clientName;
	string teamMemberName;
	string titleName;
	double payRate;
	float hoursWorked;
	srand(time(0)); 
	int invoiceNumber = (rand() % 99999 + 9999);
	int count;
	count = 1;
	
	Invoice form;


	userResponse = 'Y';
	ofstream outputFile; //open the file outside the loop to let the user finish all the input and entering the data to the file as they put it in
	outputFile.open("AndrewSmithProjectThreeInput.txt");

	while(userResponse != 'D' )
	{	
		cout << "\nPlease enter your clients name: " ;
		cin.clear();// using some cin clears beacuse the program was skipping some inputs 
		getline (cin,clientName);
		
		cout << "\nThank you " << clientName << " Now please have your team member information ready!\n";
		cout << "OK lets get started! \n" << endl;
		cin.clear();
		userResponse = 'Y'; // this keeps the loop going after the user enthers in the first client
	
		while (userResponse != 'N' && userResponse != 'D' )
		{
			cout << "Please enter the team member's name: ";
			cin.clear();
			getline (cin,teamMemberName);// still need to add the not null validation
			cout << "\nThank you!\n" << endl;
			cout << "Now please select the team member " << teamMemberName << "'s job title from the following" << endl;
			cout << "Type A: for Project Manager" << endl;
			cout << "Type B: for Network Administrator" << endl;
			cout << "Type C: for Network Analyst" << endl;
			cout << "Type D: for Network Design Engineer" << endl;
			cin >> titleNameSelection;

			while(titleNameSelection != 'A' && titleNameSelection != 'B' && titleNameSelection != 'C' && titleNameSelection != 'D')
			{
				cout << "\nInvalid input please enter A or B or C or D then press enter!\n";
				cin >> titleNameSelection;
			
			}
			switch(titleNameSelection)
			{
				case 'A':titleName = "Project Manager";
						payRate = 125.00;
						break;
						
				case 'B':titleName= "Network Administrator";
						 payRate = 80.00;
						break;
						
				case 'C':titleName = "Project Manager";
						 payRate= 50.00;
						break;
						
				case 'D':titleName = "Network Design Engineer";
						 payRate = 55.00;
						break;
			}

			cout << "\nPlease enter the amount of hours " << teamMemberName <<" worked. Then press enter: " ;
			cin >> hoursWorked;
			
			/*if (isalpha(hoursWorked)) // cant get this to validate for input type
			{
				cout << "Invalid input please enter a number" << endl;
				cin >> hoursWorked;
				cin.clear();
				cin.ignore(10000,'\n');
			}*/
			

			while(hoursWorked < 0 || hoursWorked > 300)
			{ 
				cout << "\nPlease enter the amount of hours "<< teamMemberName << " Worked" << endl;
				cin >> hoursWorked;
				cout << "Invalid input please enter a number" << endl;
			}
				
			
			cout << "\n********" << endl;
			cout << "**Menu**" << endl;
			cout << "********" << endl;	
			cout << "Please type in one of the following choices then press enter" << endl;
			cout << "Y- To enter another team member to this client" << endl;
			cout << "N- To start a new cliet invoice" << endl;
			cout << "D- To finish and print" << endl;
			cin >> userResponse;
						
			while(userResponse != 'Y' && userResponse != 'N' && userResponse != 'D')
			{
				cout << "Invalid input please enter  Y for another team member N for next client and D to finish capitalized then press enter.\n ";
				cin >> userResponse;
			}	
	
			cin.clear();
			cin.ignore(10000,'\n');
			system("cls");	
		}
	}
	
	
	if(count == 1)
	{		
		outputFile << clientName << endl; //sending the data the user just entered to the output file
		outputFile << "Invoice Number: " << invoiceNumber << "\n\n";
		outputFile << left << setw(19) <<"Team Member Name:" << right << "|";
		outputFile << left << setw(25) << "Title:" << right << "|";
		outputFile << left << setw(7) << "Hours:" << right << "|" ;
		outputFile << left << setw(14) << "Hourly Rate:" << right << "|" ;
		outputFile << left << setw(18) << "Team Member Amount:" << endl;
		count = count + 1;
	}
	
	
	outputFile << left << setw(19) << teamMemberName << right << "|" ;
	outputFile << left << setw(25) << titleName << right << "|";
	outputFile << left  << "$" << setw(7) << hoursWorked << right << "|" ;
	outputFile << left  << "$" << setw(14) << payRate << right << "|" ;
	outputFile << left  << "$" << setw(18) << form.getMemAmmount() << endl; 
	
			
	if(userResponse == 'N' || userResponse == 'D' )
	{
		outputFile << "\nTotal $" << form.getMemTotal() << endl;
	}
	
	
	if(userResponse == 'N')// a statement that will add the invoice titles if the user starts a new client
	{
		count = 1;
	}
	
	cin.clear();
	cin.ignore(10000,'\n');
	system("cls");	
	outputFile << "\n\n";
	outputFile.close();
	
	void output();
}
closed account (48T7M4Gy)
What does the whole error message say? Usually it gives an indication of the function or class it can't find.

Have you incorporated the header files in the project? A linker error occurs if you haven't.

C:\Users\Andrew\Desktop\C++\PROJECT 3>cl /EHsc AndrewSmithProjectThreeMain.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

AndrewSmithProjectThreeMain.cpp
Microsoft (R) Incremental Linker Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.

/out:AndrewSmithProjectThreeMain.exe
AndrewSmithProjectThreeMain.obj
AndrewSmithProjectThreeMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getMemAmmount(void)" (?getMemAmmount@Invoice@@QAENXZ) referenced in function _main
AndrewSmithProjectThreeMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getMemTotal(void)" (?getMemTotal@Invoice@@QAENXZ) referenced in function _main
AndrewSmithProjectThreeMain.exe : fatal error LNK1120: 2 unresolved externals

closed account (48T7M4Gy)
AndrewSmithProjectThreeMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getMemAmmount(void)" (?getMemAmmount@Invoice@@QAENXZ) referenced in function _main
AndrewSmithProjectThreeMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getMemTotal(void)" (?getMemTotal@Invoice@@QAENXZ) referenced in function _main
AndrewSmithProjectThreeMain.exe : fatal error LNK1120: 2 unresolved externals


What this means is the linker can't find the files with those two functions ie unresolved externals.

It looks like you are using VStudio so what you need to do is add the files to your project. You can do this by going to the Project menu and selecting Add existing item
I'm using notepad++ and VS2015 x86 Native Tools Command Prompt
So my ifndef was not in all caps I fixed that and now I have this error.


C:\Users\Andrew\Desktop\C++\PROJECT 3>cl /EHsc AndrewSmithProjectThreeMain.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

AndrewSmithProjectThreeMain.cpp
Microsoft (R) Incremental Linker Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.

/out:AndrewSmithProjectThreeMain.exe
AndrewSmithProjectThreeMain.obj
AndrewSmithProjectThreeMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getMemAmmount(void)" (?getMemAmmount@Invoice@@QAENXZ) referenced in function _main
AndrewSmithProjectThreeMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getMemTotal(void)" (?getMemTotal@Invoice@@QAENXZ) referenced in function _main
AndrewSmithProjectThreeMain.exe : fatal error LNK1120: 2 unresolved externals

C:\Users\Andrew\Desktop\C++\PROJECT 3>
So I have


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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include "AndrewSmithProjectThreeClass.h"
using namespace std; 

void output()
{
	string nextLine = "";
	
	ifstream inputFile;
	
	inputFile.open("AndrewSmithProjectThreeInput.txt");
	
	while (getline(inputFile, nextLine))//output the entire file to the prompt
	{
		cout << nextLine << endl;
		
	}	   
}
	
int main()
{
	char titleNameSelection;	
	char userResponse;
	string clientName;
	string teamMemberName;
	string titleName;
	double payRate;
	float hoursWorked;
	srand(time(0)); 
	int invoiceNumber = (rand() % 99999 + 9999);
	int count;
	count = 1;
	
	Invoice form;


	userResponse = 'Y';
	ofstream outputFile; //open the file outside the loop to let the user finish all the input and entering the data to the file as they put it in
	outputFile.open("AndrewSmithProjectThreeInput.txt");

	while(userResponse != 'D' )
	{	
		cout << "\nPlease enter your clients name: " ;
		cin.clear();// using some cin clears beacuse the program was skipping some inputs 
		getline (cin,clientName);
		
		cout << "\nThank you " << clientName << " Now please have your team member information ready!\n";
		cout << "OK lets get started! \n" << endl;
		cin.clear();
		userResponse = 'Y'; // this keeps the loop going after the user enthers in the first client
	
		while (userResponse != 'N' && userResponse != 'D' )
		{
			cout << "Please enter the team member's name: ";
			cin.clear();
			getline (cin,teamMemberName);// still need to add the not null validation
			cout << "\nThank you!\n" << endl;
			cout << "Now please select the team member " << teamMemberName << "'s job title from the following" << endl;
			cout << "Type A: for Project Manager" << endl;
			cout << "Type B: for Network Administrator" << endl;
			cout << "Type C: for Network Analyst" << endl;
			cout << "Type D: for Network Design Engineer" << endl;
			cin >> titleNameSelection;

			while(titleNameSelection != 'A' && titleNameSelection != 'B' && titleNameSelection != 'C' && titleNameSelection != 'D')
			{
				cout << "\nInvalid input please enter A or B or C or D then press enter!\n";
				cin >> titleNameSelection;
			
			}
			switch(titleNameSelection)
			{
				case 'A':titleName = "Project Manager";
						payRate = 125.00;
						break;
						
				case 'B':titleName= "Network Administrator";
						 payRate = 80.00;
						break;
						
				case 'C':titleName = "Project Manager";
						 payRate= 50.00;
						break;
						
				case 'D':titleName = "Network Design Engineer";
						 payRate = 55.00;
						break;
			}

			cout << "\nPlease enter the amount of hours " << teamMemberName <<" worked. Then press enter: " ;
			cin >> hoursWorked;
			
			/*if (isalpha(hoursWorked)) // cant get this to validate for input type
			{
				cout << "Invalid input please enter a number" << endl;
				cin >> hoursWorked;
				cin.clear();
				cin.ignore(10000,'\n');
			}*/
			

			while(hoursWorked < 0 || hoursWorked > 300)
			{ 
				cout << "\nPlease enter the amount of hours "<< teamMemberName << " Worked" << endl;
				cin >> hoursWorked;
				cout << "Invalid input please enter a number" << endl;
			}
				
			
			cout << "\n********" << endl;
			cout << "**Menu**" << endl;
			cout << "********" << endl;	
			cout << "Please type in one of the following choices then press enter" << endl;
			cout << "Y- To enter another team member to this client" << endl;
			cout << "N- To start a new cliet invoice" << endl;
			cout << "D- To finish and print" << endl;
			cin >> userResponse;
						
			while(userResponse != 'Y' && userResponse != 'N' && userResponse != 'D')
			{
				cout << "Invalid input please enter  Y for another team member N for next client and D to finish capitalized then press enter.\n ";
				cin >> userResponse;
			}	
	
			cin.clear();
			cin.ignore(10000,'\n');
			system("cls");	
		}
	}
	
	
	if(count == 1)
	{		
		outputFile << clientName << endl; //sending the data the user just entered to the output file
		outputFile << "Invoice Number: " << invoiceNumber << "\n\n";
		outputFile << left << setw(19) <<"Team Member Name:" << right << "|";
		outputFile << left << setw(25) << "Title:" << right << "|";
		outputFile << left << setw(7) << "Hours:" << right << "|" ;
		outputFile << left << setw(14) << "Hourly Rate:" << right << "|" ;
		outputFile << left << setw(18) << "Team Member Amount:" << endl;
		count = count + 1;
	}
	
	
	outputFile << left << setw(19) << teamMemberName << right << "|" ;
	outputFile << left << setw(25) << titleName << right << "|";
	outputFile << left  << "$" << setw(7) << hoursWorked << right << "|" ;
	outputFile << left  << "$" << setw(14) << payRate << right << "|" ;
	outputFile << left  << "$" << setw(18) << form.getMemAmmount(hoursWorked, payRate) << endl; 
	
			
	if(userResponse == 'N' || userResponse == 'D' )
	{
		outputFile << "\nTotal $" << form.getMemTotal(form.getMemAmmount(hoursWorked, payRate)) << endl;
	}
	
	
	if(userResponse == 'N')// a statement that will add the invoice titles if the user starts a new client
	{
		count = 1;
	}
	
	cin.clear();
	cin.ignore(10000,'\n');
	system("cls");	
	outputFile << "\n\n";
	outputFile.close();
	
	void output();
}



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "AndrewSmithProjectThreeClass.h"

void AndrewSmithProjectThreeClass :: getMemAmmount(float hWorked , double pRate)
{
	tMAmmount = (hWorked * pRate);
	return tMAmmount;
}

double AndrewSmithProjectThreeClass :: getMemTotal(double tmAmmount)
{
	iTotal = 0;
	iTotal = iTotal + tmAmmount;
	return iTotal;
}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef ANDREWSMITHPROJECTTHREECLASS_H
#define ANDREWSMITHPROJECTTHREECLASS_H

	
class Invoice
{
	private:
	double tMAmmount;
	double iTotal;
	
	public:
	double getMemAmmount(float, double);
	double getMemTotal(double);
};
#endif 



I'm assuming the error is in main on line 157 but im getting these errors


C:\Users\Andrew\Desktop\C++\PROJECT 3>cl /EHsc AndrewSmithProjectThreeMain.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

AndrewSmithProjectThreeMain.cpp
Microsoft (R) Incremental Linker Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.

/out:AndrewSmithProjectThreeMain.exe
AndrewSmithProjectThreeMain.obj
AndrewSmithProjectThreeMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getMemAmmount(float,double)" (?getMemAmmount@Invoice@@QAENMN@Z) referenced in function _main
AndrewSmithProjectThreeMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getMemTotal(double)" (?getMemTotal@Invoice@@QAENN@Z) referenced in function _main
AndrewSmithProjectThreeMain.exe : fatal error LNK1120: 2 unresolved externals

C:\Users\Andrew\Desktop\C++\PROJECT 3>
closed account (48T7M4Gy)
You have serious naming problems. Bluntly ...

1. You want to get rid of naming your files and variables with silly names, they are too long and meaningless.
2. Amount has a single m.
3. getMemTotal etc are stupid names, use getTotal etc
4. Your class is Invoice, not the AndrewSmithProjectThreeClass :: absurdity
5. The class prototypes must be compatible with their implementation, parameters AND return values. Swapping parameters around and returning a double from a void method doesn't work!

That's a start.

PS Why use Notepad++, it's crap, especially for beginners.



Granted my naming conventions are a little more descriptive then most but as a beginner descriptiveness is the lest of my worries and also you can name a variable anything you want that is not why my program is not working. Thanks for the other tips I will continue to research and learn what I can.
closed account (48T7M4Gy)
You also don't have an Invoice constructor!
closed account (48T7M4Gy)
Once you fix up those problems and remove and reload the files into the project you will find it runs. Until you do those things you are going to continue spinning your wheels.
closed account (48T7M4Gy)
Invoice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef INVOICE_H
#define INVOICE_H

class Invoice
{
private:
	double tAmount;
	double iTotal;

public:
	Invoice() { };
	double getAmount(double, float);
	double getTotal(double);
};
#endif 

Invoice.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "invoice.h"

double Invoice::getAmount(double hWorked, float pRate)
{
	tAmount = (hWorked * pRate);
	return tAmount;
}

double Invoice::getTotal(double amount)
{
	iTotal = 0;
	iTotal = iTotal + amount;
	return iTotal;
}

ridiculously_long_and_stupid_name.cpp
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>

#include "invoice.h"

using namespace std;

void output()
{
	string nextLine = "";

	ifstream inputFile;

	inputFile.open("AndrewSmithProjectThreeInput.txt");

	while (getline(inputFile, nextLine))//output the entire file to the prompt
	{
		cout << nextLine << endl;

	}
}

int main()
{
	char titleNameSelection;
	char userResponse;
	string clientName;
	string teamMemberName;
	string titleName;
	double payRate;
	float hoursWorked;
	srand(time(0));
	int invoiceNumber = (rand() % 99999 + 9999);
	int count;
	count = 1;

	Invoice form;


	userResponse = 'Y';
	ofstream outputFile; //open the file outside the loop to let the user finish all the input and entering the data to the file as they put it in
	outputFile.open("AndrewSmithProjectThreeInput.txt");

	while (userResponse != 'D')
	{
		cout << "\nPlease enter your clients name: ";
		cin.clear();// using some cin clears beacuse the program was skipping some inputs 
		getline(cin, clientName);

		cout << "\nThank you " << clientName << " Now please have your team member information ready!\n";
		cout << "OK lets get started! \n" << endl;
		cin.clear();
		userResponse = 'Y'; // this keeps the loop going after the user enthers in the first client

		while (userResponse != 'N' && userResponse != 'D')
		{
			cout << "Please enter the team member's name: ";
			cin.clear();
			getline(cin, teamMemberName);// still need to add the not null validation
			cout << "\nThank you!\n" << endl;
			cout << "Now please select the team member " << teamMemberName << "'s job title from the following" << endl;
			cout << "Type A: for Project Manager" << endl;
			cout << "Type B: for Network Administrator" << endl;
			cout << "Type C: for Network Analyst" << endl;
			cout << "Type D: for Network Design Engineer" << endl;
			cin >> titleNameSelection;

			while (titleNameSelection != 'A' && titleNameSelection != 'B' && titleNameSelection != 'C' && titleNameSelection != 'D')
			{
				cout << "\nInvalid input please enter A or B or C or D then press enter!\n";
				cin >> titleNameSelection;

			}
			switch (titleNameSelection)
			{
			case 'A':titleName = "Project Manager";
				payRate = 125.00;
				break;

			case 'B':titleName = "Network Administrator";
				payRate = 80.00;
				break;

			case 'C':titleName = "Project Manager";
				payRate = 50.00;
				break;

			case 'D':titleName = "Network Design Engineer";
				payRate = 55.00;
				break;
			}

			cout << "\nPlease enter the amount of hours " << teamMemberName << " worked. Then press enter: ";
			cin >> hoursWorked;

			/*if (isalpha(hoursWorked)) // cant get this to validate for input type
			{
			cout << "Invalid input please enter a number" << endl;
			cin >> hoursWorked;
			cin.clear();
			cin.ignore(10000,'\n');
			}*/


			while (hoursWorked < 0 || hoursWorked > 300)
			{
				cout << "\nPlease enter the amount of hours " << teamMemberName << " Worked" << endl;
				cin >> hoursWorked;
				cout << "Invalid input please enter a number" << endl;
			}


			cout << "\n********" << endl;
			cout << "**Menu**" << endl;
			cout << "********" << endl;
			cout << "Please type in one of the following choices then press enter" << endl;
			cout << "Y- To enter another team member to this client" << endl;
			cout << "N- To start a new cliet invoice" << endl;
			cout << "D- To finish and print" << endl;
			cin >> userResponse;

			while (userResponse != 'Y' && userResponse != 'N' && userResponse != 'D')
			{
				cout << "Invalid input please enter  Y for another team member N for next client and D to finish capitalized then press enter.\n ";
				cin >> userResponse;
			}

			cin.clear();
			cin.ignore(10000, '\n');
			system("cls");
		}
	}


	if (count == 1)
	{
		outputFile << clientName << endl; //sending the data the user just entered to the output file
		outputFile << "Invoice Number: " << invoiceNumber << "\n\n";
		outputFile << left << setw(19) << "Team Member Name:" << right << "|";
		outputFile << left << setw(25) << "Title:" << right << "|";
		outputFile << left << setw(7) << "Hours:" << right << "|";
		outputFile << left << setw(14) << "Hourly Rate:" << right << "|";
		outputFile << left << setw(18) << "Team Member Amount:" << endl;
		count = count + 1;
	}


	outputFile << left << setw(19) << teamMemberName << right << "|";
	outputFile << left << setw(25) << titleName << right << "|";
	outputFile << left << "$" << setw(7) << hoursWorked << right << "|";
	outputFile << left << "$" << setw(14) << payRate << right << "|";
	outputFile << left << "$" << setw(18) << form.getAmount(hoursWorked, payRate) << endl;


	if (userResponse == 'N' || userResponse == 'D')
	{
		outputFile << "\nTotal $" << form.getTotal(form.getAmount(hoursWorked, payRate)) << endl;
	}


	if (userResponse == 'N')// a statement that will add the invoice titles if the user starts a new client
	{
		count = 1;
	}

	cin.clear();
	cin.ignore(10000, '\n');
	system("cls");
	outputFile << "\n\n";
	outputFile.close();

	void output();
}

Last edited on
"ridiculously_long_and_stupid_name.cpp" Definitely my favorite part!! But thank you the other stuff, it has helped. I have began reading more on it and I will try in the future not to use long names.

C:\Users\Andrew\Desktop\C++\PROJECT 3>cl /EHsc invoiceMain.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

invoiceMain.cpp
Microsoft (R) Incremental Linker Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.

/out:invoiceMain.exe
invoiceMain.obj
invoiceMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getAmount(float,double)" (?getAmount@Invoice@@QAENMN@Z) referenced in function _main
invoiceMain.obj : error LNK2019: unresolved external symbol "public: double __thiscall Invoice::getTotal(double)" (?getTotal@Invoice@@QAENN@Z) referenced in function _main
invoiceMain.exe : fatal error LNK1120: 2 unresolved externals

C:\Users\Andrew\Desktop\C++\PROJECT 3>
closed account (48T7M4Gy)
I assume this last post of yours means you still can't get it to run.

The code I posted here runs without linker problems with Visual Studio 2015 by manually adding the 3 files to a blank project using the menu items I referred to before.

This is the partial output in the cmd.exe box


Please enter your clients name: Andrew Long

Thank you Andrew Long Now please have your team member information ready!
OK lets get started!

Please enter the team member's name: Silly Name

Thank you!

Now please select the team member Silly Name's job title from the following
Type A: for Project Manager
Type B: for Network Administrator
Type C: for Network Analyst
Type D: for Network Design Engineer
B

Please enter the amount of hours Silly Name worked. Then press enter:
Last edited on
closed account (48T7M4Gy)
Granted my naming conventions are a little more descriptive then most but as a beginner descriptiveness is the lest of my worries and also you can name a variable anything you want that is not why my program is not working.


I just noticed this piece of rubbish. Many people come here, and I am not a gatekeeper, are in denial just as this example demonstrates.

Good programming requires common sense and discipline. It's not magic.

Your names are ill-considered, too complicated, badly spelt and often meaningless, anything but descriptive. I am the only person who has taken a genuine interest in your unsuccessful efforts and solved your problem for you. All you want to do is argue the point, whine and not follow the advice that gets you out of the hole you have made for yourself. That doesn't make sense to me.
So the reason your are here is to try to discourage people who are new to programming? I have learned some things from you but your attitude is less than appealing and not how you help people. If it is such a bother to you please don't reply as I will do my best to avoid anything else you say. Thanks for the help and have a happy Thanksgiving (if you can ^.^)
Last edited on
I'm also reporting you, I hope you could be removed from this site
closed account (48T7M4Gy)
You're beautiful when you're angry Andrew. I've reported you for being immature and throwing a tantrum because you have trouble accepting sound advice.
Last edited on
Pages: 123