Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <iostream> using std::cout; using std::endl; // GradeBook class definit

ID: 3757030 • Letter: #

Question

#include <iostream>

using std::cout;

using std::endl;

// GradeBook class definition

class GradeBook

{

public:

// function that displays a welcome message to the GradeBook user

void displayMessage()

{

cout << "Welcome to the Grade book!" << endl;

}

};

int main()

{

GradeBook myGradeBook;

myGradeBook.displayMessage();

return 0;

}

Using this code here to answer question below.

Also using C++

Create a Use Case diagram for the class Gradebook that was presented in the PPT Case Scenario for Classes in Week3 Make sure you include all different methods and properties and add as many other methods you can think of. Add any other type of users you can think of in your diagram.

Explanation / Answer

GradeBook.h
// GradeBook class definition. This file presents GradeBook's public
// interface without revealing the implementations of GradeBook's member
// functions, which are defined in GradeBook.cpp.
#include <string> // class GradeBook uses C++ standard string class
using namespace std;

// GradeBook class definition
class GradeBook
{
public:
   GradeBook( string ); // constructor that initializes courseName
   void setCourseName( string ); // function that sets the course name
   string getCourseName(); // function that gets the course name
   void displayMessage(); // function that displays a welcome message

private:
   string courseName; // course name for this GradeBook
}; // end class GradeBook
// GradeBook class demonstration after separating
// its interface from its implementation.
#include <iostream>
#include "GradeBook.h" // include definition of class GradeBook
using namespace std;

// function main begins program execution
int main()
{
   // create two GradeBook objects
   GradeBook gradeBook1( "CS101 Introduction to C++ Programming" );
   GradeBook gradeBook2( "CS102 Data Structures in C++" );


   // display initial value of courseName for each GradeBook
   cout << "gradeBook1 created for course: " << gradeBook1.getCourseName()
      << "ngradeBook2 created for course: " << gradeBook2.getCourseName()
      << endl;
} // end main

GradeBook.cpp
// GradeBook member-function definitions. This file contains
// implementations of the member functions prototyped in GradeBook.h.
#include <iostream>
#include "GradeBook.h" // include definition of class GradeBook
using namespace std;

// constructor initializes courseName with string supplied as argument
GradeBook::GradeBook( string name )
{
   setCourseName( name ); // call set function to initialize courseName
} // end GradeBook constructor

// function to set the course name
void GradeBook::setCourseName( string name )
{
   courseName = name; // store the course name in the object
} // end function setCourseName

// function to get the course name
string GradeBook::getCourseName()
{
   return courseName; // return object's courseName
} // end function getCourseName

// display a welcome message to the GradeBook user
void GradeBook::displayMessage()
{
   // call getCourseName to get the courseName
   cout << "Welcome to the grade book forn" << getCourseName()
      << "!" << endl;
} // end function displayMessage