i have to make the C++ program that will have the user input some test grades and exam grades and their personal info then output their stuff in the end. i have almost the whole thing done, but i would compile it throws up a list of 30 erros and i am having troble with it. i think it looks good but im still not all that good with this stuff please help. here is the code

[LIST=1]
[*]#include <iostream>
[*]#include <string>
[*]using namespace std;

[*]class Grade
[*]{
[*]private:
[*]	string firstName;
[*]	string lastName;
[*]	int idNum;
[*]	int numHomeworks;
[*]	int numExams;
[*]	int listSize;
[*]	int score;
[*]	int grades;
[*]	

[*]public:
[*]	void getStudentInfo();
[*]	void getExamGrades(grades, Grade::numExams);
[*]	void getHWGrades(grades, Grade::numExams, listSize);
[*]	void calcTotalPoints(grades, listSize);
[*]	void calcLetterGrade();
[*]	void displayInfo();
[*]	void setID(int id);
[*]	void setScore(int grades);
[*]	void setExams(int exams);
[*]	void setName(string fn, string ln);

[*]	

[*]	
[*]	Grade(string, string, int, int, int, int);
[*]};


[*]Grade::Grade(string fn, string ln, int id, int grades; int exams, int listSize)
[*]{
[*]	firstName = fn;
[*]	lastName = ln;
[*]	idNum = id;
[*]	grades = grades;
[*]	numExams = exams;
[*]	listSize = listSize;
[*]}

[*]void Grade::setID(int id)
[*]{
[*]	idNum = id;
[*]}
[*]void Grade::setScore(int grades)
[*]{
[*]	grades = grades;
[*]}

[*]void Grade::setExams(int exams)
[*]{
[*]	numExams = exams;
[*]}

[*]void Grade::setName(string fn, string ln)
[*]{
[*]	firstName = fn;
[*]	lastName = ln;
[*]}
[*]void Grade::getStudentInfo()
[*]{
[*]	cout << "First Name: " << endl;
[*]	cin >> firstName;
[*]	cout <<"Last Name: " <<endl;
[*]	cin >> lastName;
[*]	cout <<"ID: "<<endl;
[*]	cin >>idNum;
[*]}
[*]void Grade::getExamGrades(grades, Grade::numExams)
[*]{
[*]	
[*]	cout <<"Score for Exam #1: "<<endl;
[*]	cin >> numExams;
[*]	cout <<"Score for Exam #2: "<<endl;
[*]	cin >> numExams;
[*]	
[*]}
[*]void Grades::getHWGrades(grades, Grade::numExams, listSize)
[*]{
[*]	cout <<"Score for Homework #1: "<<endl;
[*]	cin >> grades;
[*]	cout <<"Score for Homework #2: "<<endl;
[*]	cin >> grades;
[*]	cout <<"Score for Homework #3: "<<endl;
[*]	cin >> grades;
[*]	cout <<"Score for Homework #4: "<<endl;
[*]	cin >> grades;
[*]	cout <<"Score for Homework #5: "<<endl;
[*]	cin >> grades;
[*]	cout <<"Score for Homework #6: "<<endl;
[*]	cin >> grades;
[*]	cout <<"Score for Homework #7: "<<endl;
[*]	cin >> grades;
[*]	cout <<"Score for Homework #8: "<<endl;
[*]	cin >> grades;
[*]	cout <<"Score for Homework #9: "<<endl;
[*]	cin >> grades;
[*]	cout <<"Score for Homework #10: "<<endl;
[*]	cin >> grades;
[*]}

[*]void Grade::calcTotalPoints(grades, listSize)
[*]{
[*]	grade*10+numExams*2=score
[*]	
[*]}
[*]void Grade::calcLetterGrade();
[*]{
[*]	if (score < 59)
[*]	{
[*]		cout << " Letter grade is F" << endl;
[*]	}
[*]	if (score == 60)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 69)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 68)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 67)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 66)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 65)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 64)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 63)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 62)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 61)
[*]	{
[*]		cout << " Letter grade is D" << endl;
[*]	}
[*]	if (score == 70)
[*]	{
[*]		cout << " Letter grade is C" << endl;
[*]	}
[*]	if (score == 71)
[*]	{
[*]		cout << " Letter grade is C" << endl;
[*]	}
[*]	if (score == 72)
[*]	{
[*]		cout << " Letter grade is C" << endl;
[*]	}
[*]	if (score == 73)
[*]	{
[*]		cout << " Letter grade is C" << endl;
[*]	}
[*]	if (score == 74)
[*]	{
[*]		cout << " Letter grade is C" << endl;
[*]	}
[*]	if (score == 75)
[*]	{
[*]		cout << " Letter grade is C" << endl;
[*]	}
[*]	if (score == 76)
[*]	{
[*]		cout << " Letter grade is C" << endl;
[*]	}
[*]	if (score == 77)
[*]	{
[*]		cout << " Letter grade is C" << endl;
[*]	}
[*]	if (score == 78)
[*]	{
[*]		cout << " Letter grade is C "<< endl;
[*]	}
[*]	if (score == 79)
[*]	{
[*]		cout << " Letter grade is C" << endl;
[*]	}
[*]	if (score == 80)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score == 81)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score == 82)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score == 83)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score == 84)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score == 85)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score == 86)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score == 87)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score == 88)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score == 89)
[*]	{
[*]		cout << " Letter grade is B" << endl;
[*]	}
[*]	if (score > 90)
[*]	{
[*]		cout << " Letter grade is A" << endl;
[*]	}
[*]}

[*]void Grade::displayInfo()
[*]{
[*]	cout<<"-----Grade Report-----"<<endl;
[*]	cout<<"Student #: "<<idNum<<endl;
[*]	cout<<"Name: "<<firstName<<" "<<lastName<<endl;
[*]	cout<<"Total Points: "<<score<<endl;
[*]	cout<<"Grade: "<<myGrade.calcLetterGrade<<endl;
[*]}


[*]void main()
[*]{
[*] Grade myGrade; // declare a Grade object
[*] const int listSize = Grade::numExams + Grade::numHomeworks; // determine array size
[*] int grades[listSize]; // create array
[*] myGrade.getStudentInfo(); 
[*]    // Prompt for and obtain first name, last name, and id
[*]    // Ensures that the value entered for id is exactly 4 digits
[*] myGrade.getExamGrades(grades, Grade::numExams);
[*]    // Prompts for and reads in the exam scores
[*]    // Ensures that exam scores are not less than zero
[*] myGrade.getHWGrades(grades, Grade::numExams, listSize);
[*]    // Prompts for and reads in the homework scores
[*]    // Ensures that homeworks scores are greater than zero and less than 26
[*] myGrade.calcTotalPoints(grades, listSize);
[*]    // Calculates total points (data member)
[*]    // Prompts for and obtains office visit value (and includes it in total points)
[*] myGrade.calcLetterGrade();
[*]    // Determines letter grade (data member) 
[*] myGrade.displayInfo();
[*]    // Outputs all data member values (with formatting text)
[*]}
[/LIST]

If you see any errors ar anyway that i could get this to compile please let me know. i would really apreciate it. thanks

P.S. i also attached both the .cpp file and the compiler output tex file aswell.

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

class Grade
{
private:
	string firstName;
	string lastName;
	int idNum;
	int numHomeworks;
	int numExams;
	int listSize;
	int score;
	int grades;
	

public:
	void getStudentInfo();
	void getExamGrades(grades, Grade::numExams);
	void getHWGrades(grades, Grade::numExams, listSize);
	void calcTotalPoints(grades, listSize);
	void calcLetterGrade();
	void displayInfo();
	void setID(int id);
	void setScore(int grades);
	void setExams(int exams);
	void setName(string fn, string ln);

	

	
	Grade(string, string, int, int, int, int);
};


Grade::Grade(string fn, string ln, int id, int grades; int exams, int listSize)
{
	firstName = fn;
	lastName = ln;
	idNum = id;
	grades = grades;
	numExams = exams;
	listSize = listSize;
}

void Grade::setID(int id)
{
	idNum = id;
}
void Grade::setScore(int grades)
{
	grades = grades;
}

void Grade::setExams(int exams)
{
	numExams = exams;
}

void Grade::setName(string fn, string ln)
{
	firstName = fn;
	lastName = ln;
}
void Grade::getStudentInfo()
{
	cout << "First Name: " << endl;
	cin >> firstName;
	cout <<"Last Name: " <<endl;
	cin >> lastName;
	cout <<"ID: "<<endl;
	cin >>idNum;
}
void Grade::getExamGrades(grades, Grade::numExams)
{
	
	cout <<"Score for Exam #1: "<<endl;
	cin >> numExams;
	cout <<"Score for Exam #2: "<<endl;
	cin >> numExams;
	
}
void Grades::getHWGrades(grades, Grade::numExams, listSize)
{
	cout <<"Score for Homework #1: "<<endl;
	cin >> grades;
	cout <<"Score for Homework #2: "<<endl;
	cin >> grades;
	cout <<"Score for Homework #3: "<<endl;
	cin >> grades;
	cout <<"Score for Homework #4: "<<endl;
	cin >> grades;
	cout <<"Score for Homework #5: "<<endl;
	cin >> grades;
	cout <<"Score for Homework #6: "<<endl;
	cin >> grades;
	cout <<"Score for Homework #7: "<<endl;
	cin >> grades;
	cout <<"Score for Homework #8: "<<endl;
	cin >> grades;
	cout <<"Score for Homework #9: "<<endl;
	cin >> grades;
	cout <<"Score for Homework #10: "<<endl;
	cin >> grades;
}

void Grade::calcTotalPoints(grades, listSize)
{
	grade*10+numExams*2=score
	
}
void Grade::calcLetterGrade();
{
	if (score < 59)
	{
		cout << " Letter grade is F" << endl;
	}
	if (score == 60)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 69)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 68)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 67)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 66)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 65)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 64)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 63)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 62)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 61)
	{
		cout << " Letter grade is D" << endl;
	}
	if (score == 70)
	{
		cout << " Letter grade is C" << endl;
	}
	if (score == 71)
	{
		cout << " Letter grade is C" << endl;
	}
	if (score == 72)
	{
		cout << " Letter grade is C" << endl;
	}
	if (score == 73)
	{
		cout << " Letter grade is C" << endl;
	}
	if (score == 74)
	{
		cout << " Letter grade is C" << endl;
	}
	if (score == 75)
	{
		cout << " Letter grade is C" << endl;
	}
	if (score == 76)
	{
		cout << " Letter grade is C" << endl;
	}
	if (score == 77)
	{
		cout << " Letter grade is C" << endl;
	}
	if (score == 78)
	{
		cout << " Letter grade is C "<< endl;
	}
	if (score == 79)
	{
		cout << " Letter grade is C" << endl;
	}
	if (score == 80)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score == 81)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score == 82)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score == 83)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score == 84)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score == 85)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score == 86)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score == 87)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score == 88)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score == 89)
	{
		cout << " Letter grade is B" << endl;
	}
	if (score > 90)
	{
		cout << " Letter grade is A" << endl;
	}
}

void Grade::displayInfo()
{
	cout<<"-----Grade Report-----"<<endl;
	cout<<"Student #: "<<idNum<<endl;
	cout<<"Name: "<<firstName<<" "<<lastName<<endl;
	cout<<"Total Points: "<<score<<endl;
	cout<<"Grade: "<<myGrade.calcLetterGrade<<endl;
}


void main()
{
 Grade myGrade; // declare a Grade object
 const int listSize = Grade::numExams + Grade::numHomeworks; // determine array size
 int grades[listSize]; // create array
 myGrade.getStudentInfo(); 
    // Prompt for and obtain first name, last name, and id
    // Ensures that the value entered for id is exactly 4 digits
 myGrade.getExamGrades(grades, Grade::numExams);
    // Prompts for and reads in the exam scores
    // Ensures that exam scores are not less than zero
 myGrade.getHWGrades(grades, Grade::numExams, listSize);
    // Prompts for and reads in the homework scores
    // Ensures that homeworks scores are greater than zero and less than 26
 myGrade.calcTotalPoints(grades, listSize);
    // Calculates total points (data member)
    // Prompts for and obtains office visit value (and includes it in total points)
 myGrade.calcLetterGrade();
    // Determines letter grade (data member) 
 myGrade.displayInfo();
    // Outputs all data member values (with formatting text)
}
Error	1	error C2061: syntax error : identifier 'grades'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	20	
Error	2	error C2061: syntax error : identifier 'grades'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	21	
Error	3	error C2061: syntax error : identifier 'grades'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	22	
Error	4	error C2143: syntax error : missing ')' before ';'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	37	
Error	5	error C2761: '{ctor}' : member function redeclaration not allowed	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	37	
Error	6	error C2062: type 'int' unexpected	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	37	
Error	7	error C2059: syntax error : ')'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	37	
Error	8	error C2143: syntax error : missing ';' before '{'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	38	
Error	9	error C2447: '{' : missing function header (old-style formal list?)	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	38	
Error	10	error C2597: illegal reference to non-static member 'Grade::grades'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	75	
Error	11	error C2597: illegal reference to non-static member 'Grade::numExams'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	75	
Error	12	error C2448: 'Grade::getExamGrades' : function-style initializer appears to be a function definition	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	76	
Error	13	error C2653: 'Grades' : is not a class or namespace name	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	84	
Error	14	error C2065: 'grades' : undeclared identifier	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	84	
Error	15	error C2597: illegal reference to non-static member 'Grade::numExams'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	84	
Error	16	error C2065: 'listSize' : undeclared identifier	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	84	
Error	17	error C2448: 'getHWGrades' : function-style initializer appears to be a function definition	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	85	
Error	18	error C2597: illegal reference to non-static member 'Grade::grades'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	108	
Error	19	error C2597: illegal reference to non-static member 'Grade::listSize'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	108	
Error	20	error C2448: 'Grade::calcTotalPoints' : function-style initializer appears to be a function definition	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	109	
Error	21	error C2761: 'void Grade::calcLetterGrade(void)' : member function redeclaration not allowed	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	113	
Error	22	error C2447: '{' : missing function header (old-style formal list?)	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	114	
Error	23	error C2065: 'myGrade' : undeclared identifier	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	251	
Error	24	error C2228: left of '.calcLetterGrade' must have class/struct/union	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	251	
Error	25	error C2512: 'Grade' : no appropriate default constructor available	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	257	
Error	26	error C2597: illegal reference to non-static member 'Grade::numExams'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	258	
Error	27	error C3867: 'Grade::numExams': function call missing argument list; use '&Grade::numExams' to create a pointer to member	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	258	
Error	28	error C2597: illegal reference to non-static member 'Grade::numHomeworks'	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	258	
Error	29	error C3867: 'Grade::numHomeworks': function call missing argument list; use '&Grade::numHomeworks' to create a pointer to member	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	258	
Error	30	error C2568: '+' : unable to resolve function overload	c:\documents and settings\user121\my documents\visual studio 2005\projects\assignment 8\assignment 8\assignment 8.cpp	258

Wow... Before worrying about getting it to compile, you might want to think about writing a design document to get your logic straight.

But...
Your error log tells you what is wrong. In your class declaration, you aren't referring to valid types, you are referring to your own names for things. Problem.

main isn't a void function.

You declare Grade::numExams and Grade::grades as private, and non-static, then immediately try to use them in a public fashion in main. At this point they are A) unaccessible, and B) uninitialized.

In your class, er, how many of your actual homework assignment grades get recorded somewhere? Well, all of them, but only #10 matters, since you keep overwriting the same variable. Ditto the exam grades, except there you only overwrite once.

CalcLetterGrade... er, isn't there perhaps a better method of doing this? Maybe with relational operators? And you miss the case where grade is 90.

Again, the errors list is pretty good, why not work through that from the first down, recompiling every time you fix something.

Incremental Compiles are always better than just writing a bunch of code and preying for the best.

Thanks for the help. I wouldn't have able to get it figured out without you.

This article has been dead for over six months. Start a new discussion instead.