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

Lab: Accessing Pointers to Classes and Structs 1a. Design a UML diagram for a Gr

ID: 3534567 • Letter: L

Question

Lab: Accessing Pointers to Classes and Structs

1a. Design a UML diagram for a Grade class with the following private data members:

· char letterGrade;

· int numericGrade;

· string student;

Create a Grade class named Grade.h that includes the following private member method:

· void calcLetterGrade() to calculate a letter grade depending on the numeric grade

The Grade class should also include the following public member methods:

· char getLetterGrade() to return the letterGrade

· int getNumericGrade() to return the numericGrade

· string getStudent() to return the string student

· a constructor to prompt the user for a student name and a numeric grade, and to call calcLetterGrade()

1b. Write the implementation file Grade.cpp for the class Grade, compile, and save

Grade::Grade()//Ask for student name and grade then run calcLetterGrade()

void Grade::calcLetterGrade()//use switch to assign grade. /*calc letter grade should use the value of
numericGrade divided by 10 as the switch
value to match with the case label for
10, 9, 8, 7, and 6 to assign the character
A, B, C, and D to the variable letterGrade.
The default character F should be assigned.*/

char Grade::getLetterGrade() //return letterGrade

string Grade::getStudent() // return student name

int Grade::getNumericGrade()//return numeric grade

1c. Write a C++ program to test your class that uses pointer notation to the class Grade and name it TestGrade.cpp. Step through the code by hand.

#include <iostream>

#include <string>

#include "grade.h"

using namespace std;

void instruct();

int main()
{
instruct();

Grade *studentPtr = NULL, student;

studentPtr = &__________;

cout << endl
<< ___________ -> ___________() <<
" has a score of "
<< ___________ -> _______________()
<<
" for a letter grade of "
<< __________ -> ______________() << endl;
return 0;

}

void instruct()
{
cout <<
"This program uses pointer notation to the "
<< "class Grade. ";

}

Following is a copy of the screen results that might appear after running your program. Input by the user is shown in bold.

This program uses pointer notation to the class Grade.

Enter student's name: Zelda Goldstein

Enter numeric score: 86

Zelda Goldstein has a score of 86 for a letter grade of B

Explanation / Answer

Please rate with 5 srats :)


Here is what you need:


http://www.google.co.in/imgres?imgurl=http://www.smccd.net/accounts/nilsonk/smc2006fallcis382/project02/single/figures/project02/project2ClassDiagram.png&imgrefurl=http://www.smccd.net/accounts/nilsonk/smc2006fallcis382/project02/single/&h=566&w=1049&sz=73&tbnid=j8ck2ZwblUWjQM:&tbnh=65&tbnw=120&zoom=1&usg=__v8lN9uFSV0nlGp5gcK-sc2ieFGE=&docid=OyZQV0rERI1kOM&sa=X&ei=XO55UaGfCoKuiAfFw4AY&ved=0CEgQ9QEwAw&dur=1