Hello again everyone. This one is a project to help with understanding another project (aren't they all?)... At any rate, this was running up through main where I was attempting to call and get my grade computation function (which you'll see a bunch of stuff commented out). I fooled around trying to get my 'total_analyzer' function to output a grade in main and now I'm getting a constructor error "not allowed a return type." As far as I can tell, my constructor is exactly the way it was so I give up:

#include <iostream>
using namespace std;

class StudentRecord

{

	private:
		double  quizzes, final, midterm, total_grade;
		char letter_grade;

	public:
		StudentRecord();
		void letter_assignation(char letter_grade, double final_grade);
		void total_analyzer(double total_grade);
		double quiz_maker(double quiz1, double quiz2);
		double finalizer(double final);
		double midtermer(double midterm);

		//double get_quiz();
		//double get_final();
		//double get_midterm();
		
		//void get_final_numeric(double numeric);
}


StudentRecord::StudentRecord()
{
	total_grade = 0;
	quizzes = 0;
	final = 0;
	midterm = 0;
	letter_grade = 0;
}


void StudentRecord::total_analyzer(double total_average)
{
	total_grade = total_average;
	total_average = (quizzes * .25) + (midterm * .25) + (final * .50);
}

void StudentRecord::letter_assignation(char letter_maker, double numeric_grade)
{
	letter_grade = letter_maker;
	if(numeric_grade < 60)
	{
		letter_maker = 'F';
	}
	else if((numeric_grade <= 70) && (numeric_grade > 60))
	{
		letter_maker = 'D';
	}
	else if((numeric_grade < 80) && (numeric_grade > 70))
	{
		letter_maker = 'C';
	}
	else if((numeric_grade >= 80) && (numeric_grade < 90))
	{
		letter_maker = 'B';
	}
	else if(numeric_grade >= 90)
	{
		letter_maker = 'A';
	}
}


double StudentRecord::quiz_maker(double quizz1, double quizz2)
{
	quizzes = (quizz1 + quizz2)* 10;
	return quizzes;
}

double StudentRecord::midtermer(double midterm_grade)
{
	midterm = midterm_grade;
	return midterm;
}


double StudentRecord::finalizer(double final_grade)
{
	final = final_grade;
	return final;
}

//void StudentRecord::get_final_numeric(double numeric)
//{
	//total_grade = numeric;
// }








int main()
{
	double Quizz1, Quizz2, Midterm, Final, total_numeric, numeric1;



	StudentRecord GradeMachine;


	cout << "Please enter your first quiz grade 1 - 10: " << endl;
	cin >> Quizz1;
	cout << "Please enter your second quiz grade 1 - 10: " << endl;
	cin >> Quizz2;
	
	GradeMachine.quiz_maker(Quizz1, Quizz2);

	cout << "Please enter your midterm grade: " << endl;
	cin >> Midterm;

	GradeMachine.midtermer(Midterm);

	cout << "Please enter your final grade: " << endl;
	cin >> Final;

	GradeMachine.finalizer(Final);


	//GradeMachine.total_analyzer(total_numeric);
	//GradeMachine.get_final_numeric(numeric1);
	//numeric1 = total_numeric;
	
	//cout << "Your total grade average is:  " << total_numeric << endl;

	return 0;
}
:confused:

Recommended Answers

All 2 Replies

Hmm, I think the problem may be that your class definition is missing a ";" at the end.

Hmm, I think the problem may be that your class definition is missing a ";" at the end.

Wow, that's pretty bad. Thanks, I was monitor blind earlier!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.