Hello all! So im taking a C++ class and I'm supposed to make a grade book program that will take in 6 programs grades and 2 test grades, then multiple the average of each by 50% and add them together for a letter grade... So that was the first project which i've already completed and got a 100 on..

Now im supposed to do the following with the same program:

You are to implement the various grade entry and calculation routines using a class object that includes (minimumly) the following public methods:

enterProgramGrades()
enterTestGrades()
calculateAverage()
displayAverage()
displayLetterGrade()
calculateGradeToMakeOnFinalExam()
displayGradeToMakeOnFinalExam()
You are free to include any additional methods to solve this problem, as well as any private member data.

.. and I don't now I don't know how to do that. I know I'm supposed to use a header file or something, but I don't how to use them. Any help is highly appreciated..

Oh.. here's the code from the working program:

#include <iostream>

using namespace std;

int main(void) {
   
	cout <<endl;
	cout << "CSE 2050 Program 1" << endl; 
	cout << "Arun Chandra" << endl; 
	cout << "autocrashx2000@yahoo"<< endl;
  
int proj[6]; //creates an array for project grades
int test[2]; // creats an array for test grades

float psum=0;// project grade sum
float tsum=0;// test grade sum
float pave=0;// project grade average
float tave=0;// test grade average
float final=0;//final grade average
  
	cout << "Let's calculate your grades!"<<endl;
	cout << "Enter your 6 program grades"<<endl; 

//this will allow you to input exactly 6 project grades 
for (int i=0; i < 6; i++) {
    cin >> proj[i];  }

//This will output the project grades
	cout << "\nThe project grades you entered were:" << endl;

for (int i=0; i < 6; i++){
    cout << proj[i]<<"  ";
	}
	cout<<endl;
		
// add the project grades together and then compute average
for (int i=0; i < 6; i++){
	psum = psum + proj[i];//this is supposed to add the values in the array
	}
	
	cout<<endl;
	cout<<"The sum of the project grades are: "<<psum<<endl;//this is to test the sum
	
	pave=psum/6;
	cout<<"Your project average is: " <<pave<<endl;//this is to test the average
	
	
	
	cout <<endl;	
	cout << "Great..................."<<endl;
	cout << "Now enter your 2 test grades"<<endl;




//this will allow you to input exactly 2 test grades
 for (int i=0; i < 2; i++) {
    cin >> test[i];  }

//This will output the test grades
	cout << "\nThe test grades you entered were:" << endl;

for (int i=0; i < 2; i++){
    cout << test[i] << "  ";
	}
	
// add the test grades together and then compute average
for (int i=0; i < 2; i++){
	tsum = tsum + test[i];}//this is supposed to add the values in the array
	
	cout<<endl;
	cout<<"The sum of the test grades are: "<<tsum<<endl;//this is to test the sum
	
	tave=tsum/2;
	cout<<tave<<endl;//this is to test the average

	pave = pave * .5;
	tave = tave * .5;
	final = pave + tave;
	cout<<"\nYour final average is: "<<final<<endl;

   if (final >= 90 )
      cout << "Your grade is an A" << endl;
   else if (final >= 80 )
      cout << "Your grade is a B" << endl;
   else if (final >= 70 )
      cout << "Your grade is a C" << endl;
   else if (final >= 60 )
      cout << "Your grade is a D" << endl;
   else 
      cout << "Your grade is an F" << endl;
	
  return 0;
}

>>but I don't how to use them
Of course you already know how to use header files because the code you posted used them, the ver first line in your program is using a header file. So all you do is create a file of your own and give it a *.h extension

//myheader.h
class Grades
{
   // your header file code goes here
};

You need to actually STUDY your text book to find out about c++ classes.

.cpp files and .h files are all different ways of saving c++ coded files. So if you type in your language save your class description as name.h and save your main file with int main() as name.cpp

then when you are writing your program...add into name.cpp #include "name.h" and that will include your header file (.h) with the rest of your program. When you run your compiler u only run the compiler on the .cpp file and it does the .h file too

Just paying it forward, someone helped me today on here :) have a nice day :)

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.