Question: C + + modify these classes and write a driver program that combines them GradeBook.h: / / GradeBook class definition in a separate file from

C++ modify these classes and write a driver program that combines them
GradeBook.h:
// GradeBook class definition in a separate file from main so that we may use this in all the programs now
#include
#include // class GradeBook uses C++ standard string class
// GradeBook class definition
class GradeBook
{
public:
// constructor initializes courseName with string supplied as argument
explicit GradeBook( std::string name )
: courseName( name )// member initializer to initialize courseName
{
// empty body
}// end GradeBook constructor
// function to set the course name
void setCourseName( std::string name )
{
courseName = name; // store the course name in the object
}// end function setCourseName
// function to get the course name
std::string getCourseName() const
{
return courseName; // return object's courseName
}// end function getCourseName
// display a welcome message to the GradeBook user
void displayMessage() const
{
// call getCourseName to get the courseName
std::cout << "Welcome to the grade book for
"<< getCourseName()
<<"!"<< std::endl;
}// end function displayMessage
void determineClassAverage() const; // averages user-entered grades
private:
std::string courseName; // course name for this GradeBook
}; // end class GradeBook
week4 program.cpp:
#include
#include
using namespace std;
void sort(char nm[][10]);
void display(char name[][10]);
int main(){
char names[10][10];
int i;
for (i=0; i<10; i++)
{
cout << "Enter name of the student : ";
cin >> names[i];
}
sort(names);
display(names);
return 0;
}
void sort(char nm[][10]){
char temp[10];
cout <<"Sorting names in Ascending Order "<< endl;
for (int i =0; i <10; ++i)
for (int j =i+1; j<10; j++)
{
if (strcmp(nm[i],nm[j])>0)
{
strcpy(temp,nm[i]);
strcpy(nm[i],nm[j]);
strcpy(nm[j],temp);
}
}
};
void display(char nm[][10]){
cout <<"Displaying names in Ascending Order "<< endl;
for (int i =0; i <10; ++i)
{
cout<< nm[i]<<""<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!