Subject Computer Science C-Family Programming

Question

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 Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse 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);...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

C++ Questions
Homework Solution
$15.00
Computer Science
Programming
Prime Numbers
Mathematics
Input
Output
Loops
Statements
Structures
Algorithms
Calendar
Leap Years
Reverse Digits
Functions
Contact List Program in C++
Homework Solution
$18.00
Computer Science
Programming
Contact List
C++
Phone Numbers
Classes
Constructors
Member Variables
Strings
Pointers
Names
People
Test Values
Menu
Functions
Print
Search
Add
Delete
Associative Arrays in C++
Homework Solution
$75.00
Programming
C++
Associative Arrays
Computer Science
Hash Tables
Chaining
Static Arrays
Game of Life
Records
Strings
Integers
Objects
Functions
Copying
Applet
Sequences
Lists
Prime Numbers
Simulations
Get help from a qualified tutor
Live Chats