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>