QuestionQuestion

Write a program that uses a structure to store the following data:
Member Name Description
Name Student name
Idnum Student ID number
Tests Pointer to an array of test scores
Average Average test score
Grade Course Grade
The program should keep a list of test scores for a group of students.
It should ask the user how many test scores there are to be and how many students there are.
It should than dynamically allocate an array of structures.
Each structure’s Tests member should point to a dynamically allocated array that will hold the test scores.
After the arrays have been dynamically allocated, the program should ask for the ID number and all the test scores for each student.
The average test score should be calculated and stored in the average member of each structure.
The course grade should be computed on the basis of the following grading scale:
Average Test Grade Course Grade
91-100 A
81-90 B
71-80 C
61-70 D
60 or below F
The course grade should then be stored in the Grade member of each structure.
Once all this data is calculated, a table should be displayed on the screen listing each student’s name, ID number, average test score and course grade.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>

using namespace std;

// The program should keep a list of test scores for a group of students.
struct Student{
    string Name;
    string Idnum;
    int * Tests;
    double Average;
    char Grade;   
};

//PROTOTYPES
int getNumber(const string & mesasge);
char courseGrade(const double & average);
string createPrompt(string message, int number);
void getValidInput(string prompt, string &input);
void getStudentData(Student & student,const int & number);
void printStudent(const Student & student, const int & number);

/*
*
*/
int main(int argc, char** argv) {
   
    // it should ask the user how many
    // test scores there are to be and how many students there are.
    string studentNumberMessage = "How many students are there? \n--> ";
    const int studentNumber = getNumber(studentNumberMessage);
    string studentTestScoreMessage = "How many test scores are there? \n--> ";
    const int studentTestScore = getNumber(studentTestScoreMessage);...

By purchasing this solution you'll be able to access the following files:
main.cpp.

50% discount

Hours
Minutes
Seconds
$16.20 $8.10
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats