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

$18.00

or $1 if you
register a new account!

Assisting Tutor

Related Homework Solutions

Dynamic Arrays in C++
Homework Solution
$8.00
Computer Science
C++ Programming
OOP
Dynamic Arrays
Functions
Donations
Codes
Loops
Statements
Variables
Pointers
Memory Allocation
Users
Constants
Input
Output
Integers
Restaurant Waitlist Using C++
Homework Solution
$13.00
Programming
C++
Computer Science
Linked Lists
Queue
People
Restaurant Waitlist
Guests
Reservations
Statements
Variables
Data Sets
Constructors
Pointers
Search
Input
Output
Right Triangle Problem in C++
Homework Solution
$15.00
Mathematics
Programming
C++
Right Triangle
Hypotenuse
Leg
Sum of Squares
Sides
Lengths
Users
Input
Output
Integers
Get help from a qualified tutor
Live Chats