Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help. Do step by step. I have given my assignment #1. Please follow the steps and modify them. Here is my assignment #1 #StudentRecord.h

Please help. Do step by step. I have given my assignment #1. Please follow the steps and modify them.

image text in transcribed

Here is my assignment #1

#StudentRecord.h

#include

using namespace std;

// Declare a class.

class StudentRecord

{

private:

// declare the private variables.

string name;

float score;

char grade;

public:

// Declare the member function of the class.

StudentRecord();

StudentRecord(string theName,float theScore);

string getName();

float getScore();

char getGrade();

};

#StudentRecord.cpp

#include "StudentRecord.h"

// constructor of the class.

StudentRecord::StudentRecord(string theName,float theScore)

{

name = theName;

score = theScore;

// Check the condition.

if(score >=90 && score

grade = 'A';

}else if(score >= 80 && score

grade = 'B';

}else if(score >= 70 && score

grade = 'C';

}else if(score >= 60 && score

grade = 'D';

}else{

grade ='F';

}

}

// Constructor of the class.

StudentRecord::StudentRecord()

{

name = "";

score = 0;

}

// Call the function.

string StudentRecord::getName(){

return name;

}

// Call the function.

float StudentRecord::getScore(){

return score;

}

// Call the function.

char StudentRecord::getGrade(){

return grade;

}

#main.cpp

#include

#include

// include the .h files..

#include "StudentRecord.h"

using namespace std;

// prototype of the function.

void disp_grade(StudentRecord[],int);

float avg_test_score(StudentRecord[],int);

float max_test_score(StudentRecord[],int);

float min_test_score(StudentRecord[],int);

// Start the main function.

int main()

{

// Declare variables.

string name;

float score;

char choice;

// declare an array of class type.

StudentRecord rec[50];

int cntr = 0;

// Start the do while loop

do

{

// prompt the user to enter the name.

cout

cin>>name;

// prompt the user to enter the score.

cout

cin>>score;

// Assign value.

rec[cntr] = StudentRecord(name,score);

cntr++;

// prompt he user to enter choice.

cout

cin>>choice;

// check teh if condition.

if(choice == 'N' || choice =='n')

{

break;

}

}while(true); // Call the function.

disp_grade(rec,cntr);

// Display the statement on console.

cout

cout

cout

cout

cout

}

// definition of the function.

void disp_grade(StudentRecord rec[],int rec_cntr)

{

// Display the statement on console.

printf(" %-20s%-20s%-20s","Name","Test Score","Grade");

printf(" %-20s%-20s%-20s","======","==========","======");

int i =0;

// Start the for loop

for(i = 0; i

{

StudentRecord sr = rec[i];

printf(" %-20s%-20.0f%-20c",sr.getName().c_str(),sr.getScore(),sr.getGrade());

}

}

// definition of the function.

float avg_test_score(StudentRecord rec[],int rec_cntr)

{

float totalScore = 0;

int i = 0;

// Start the for loop

for(i = 0; i

{

StudentRecord sr = rec[i];

totalScore = totalScore + sr.getScore();

}

return totalScore/rec_cntr;

}

// definition of the function.

float max_test_score(StudentRecord rec[],int rec_cntr)

{

float maxScore = 0;

int i = 0;

// Start the for loop

for(i = 0; i

{

StudentRecord sr = rec[i];

// Check the condition.

if(sr.getScore()>maxScore){

maxScore = sr.getScore();

}

}

return maxScore;

}

// definition of the function.

float min_test_score(StudentRecord rec[],int rec_cntr)

{

float min_score = 100;

int i = 0;

// Start the for loop

for(i = 0; i

{

StudentRecord sr = rec[i];

// Check the condition.

if(sr.getScore()

min_score = sr.getScore();

}

}

return min_score;

}

Modify assignment \# 1 so that the instructor can enter up to 5 test scores per student. The class roster should include the average test score for each student as well as the overall grade. Update the class statistics to include the average score for each of test. You must create a class called student that has the following data members. - First Name - Last Name - An array or a vector that contains the test scores. All class data members must be private or protected. Separate the class interface from the class implementation and use include guards

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions