Question

write a program that automates the process of generating the final student report for DC faculty...

write a program that automates the process of generating the final student report for DC faculty considering the following restrictions.

  1. Consider declaring three arrays for processing the student data:

studID studName studGrade

  1. The student ID is a random number generated by the 5-digit system in the range of (10000 - 99999). Create a function to assign the student ID generated in an array of numbers.

Consider the following to generate the random number:

  1. Add the libraries: #include <stdlib.h> #include <ctime>

  2. In the main function add the instruction that generates unique values:

srand(time(0))

  1. Use the following formula to generate the random number in the range of the minValue = 10000 and maxValue = 99999:

randomNumber = (rand() % (maxValue- minValue + 1)) + minValue;

Use studID for the name of the array.

  1. Student names must be assigned when the array is declared. Use studName for the name of the array.

Example:

string studName[] = { "Adam", "Josue", "Carlos", "Frank", "Alison",

"Adrian" , "Candy", "Steven", "Albert", "Alice" };

  1. Create a function to read student grades and store them in the student grade array. The program must validate that the range of possible values is from 0 to 100. If an incorrect value is entered, the system must ask again for this grade. Use studGrade for the name of the array. Consider the following code example for validation.

void GetInputGrades(int studGrade[])

{

//Ask for students grades.

for (int index = 0; index < A_SIZE; index++)

{

do

{

cout << "Grade: ";

cin >> studGrade[index];

} while (studGrade[index] > 100 || studGrade[index] < 0);

}

}


  1. Create a function to calculate the grade with letter that corresponds to the numeric grade and show it as part of the report. Generate a new array (studGradeLetter) to assign the letter that corresponds to the numeric grade. Consider the following example code.

void SetGradeLetter(int studGrade[], char studGradeLetter[])

{

//Process the student's grades and assign the letter that corresponds to the grade

//in a new array (studGradeLetter)

for (int index = 0; index < A_SIZE; index++)

{

if (studGrade[index] <= 100 && studGrade[index] >= 90) //90 - 100 studGradeLetter[index] = 'A';

  1. Create a function to calculate the number of students per grade (grade letter), and display the counter in the output report.


  1. Create a function to calculate the total number of students approved or failed. Display the result in numeric format and percentage. Example:

Hint: % Approved Students = (Total Approved * 100) / Total Students

% Fail Students = (Total Failed * 100) / Total Students

  1. Create a function to search for the student (s) with the highest grade. Display the result with the below data students.

Consider the following example code:

for (int index = 0; index < A_SIZE; index++)

{

if (studGradeLetter[index] == 'A')

cout << studID[index] << ' ' << studName[index]

<< ' ' << studGrade[index] << ' ' << studGradeLetter[index] << endl;

}


  1. Create a function to calculate the general average of the course. Display the result in the output report. For example:

  1. The final report should include the information below: Example Output:

Homework Answers

Answer #1

Please find below the code, code screenshots and output screenshots. Please refer to the screenshot of the code to understand the indentation of the code.  PPlease get back to me if you need any change in the output report as you have not added the sample output report. Else please upvote.

CODE:

#include <iostream>

#include <stdlib.h>

#include <ctime>

#define A_SIZE 10 //Declare number of students as constant

using namespace std;

//Function prototype

void GetInputGrades(int studGrade[]);

void SetGradeLetter(int studGrade[], char studGradeLetter[]);

void CalculateNumStudentsPerGrade(char studGradeLetter[]);

void CalculateApprovedFailedStudents(char studGradeLetter[]);

void SearchHighestGradeStudents(int studID[], string studName[], int studGrade[], char studGradeLetter[]);

void CalculateGeneralAverage(int studGrade[]);

//main function

int main()

{

    //Array declaration and initialization for students names

    string studName[] = { "Adam", "Josue", "Carlos", "Frank", "Alison", "Adrian" , "Candy", "Steven", "Albert", "Alice" };

    int studID[A_SIZE]; //declaring array for storing student id's

    int studGrade[A_SIZE]; //declaring array for storing student grade values

    char studGradeLetter[A_SIZE]; //declaring array for storing student grade letters

   

    //Variables used for random number generator

    int minValue = 10000;

    int maxValue = 99999;

    int randomNumber;

   

    // Use current time as seed for random generator to prevent randomNumber repetition

    srand(time(0));

   

    for(int index = 0; index<A_SIZE; index++){ //loop through each student index

        randomNumber = (rand() % (maxValue - minValue + 1)) + minValue; //generate the random number between the range

        studID[index] = randomNumber; //assign randomNumber generated to studId

    }

   

    //calling functions to generate the final report

    GetInputGrades(studGrade);

    SetGradeLetter(studGrade, studGradeLetter);

    CalculateNumStudentsPerGrade(studGradeLetter);

    CalculateApprovedFailedStudents(studGradeLetter);

    SearchHighestGradeStudents(studID, studName, studGrade, studGradeLetter);

    CalculateGeneralAverage(studGrade);

   

   return 0;

}

/***********************************************************

* Function to read the students grade values

* Argument: studGrade array

* Return Value: None

* *********************************************************/

void GetInputGrades(int studGrade[])

{

    //Ask for students grades.

    for (int index = 0; index < A_SIZE; index++) {

       

        do {

            cout << "Grade of Student "<<index+1<<": ";

            cin >> studGrade[index]; //Reading the student grade into array

        } while (studGrade[index] > 100 || studGrade[index] < 0); //Validating the grade

    }

}

/***********************************************************

* Function to Process the student's grades and

* assign the letter that corresponds to the grade

* Argument: studGrade array and studGradeLetter array

* Return Value: None

* *********************************************************/

void SetGradeLetter(int studGrade[], char studGradeLetter[])

{

    //Process the student's grades and assign the letter that corresponds to the grade

    //in a new array (studGradeLetter)

    for (int index = 0; index < A_SIZE; index++){

        if (studGrade[index] <= 100 && studGrade[index] >= 90) //90 - 100

            studGradeLetter[index] = 'A';

        else if(studGrade[index] <= 89 && studGrade[index] >= 80) //80 - 89

            studGradeLetter[index] = 'B';

        else if(studGrade[index] <= 79 && studGrade[index] >= 70) //70 - 79

            studGradeLetter[index] = 'C';

        else if(studGrade[index] <= 69 && studGrade[index] >= 60) //60 - 69

            studGradeLetter[index] = 'D';

        else if(studGrade[index] < 60) //less than 60

            studGradeLetter[index] = 'F';

    }

}

/***********************************************************

* Function to calculate the number of students per grade (grade letter),

* approved or failed

* Argument: studGradeLetter array

* Return Value: None

* *********************************************************/

void CalculateNumStudentsPerGrade(char studGradeLetter[])

{

    //Initialize counter Variables as 0

    int A_grade_count = 0;

    int B_grade_count = 0;

    int C_grade_count = 0;

    int D_grade_count = 0;

    int F_grade_count = 0;

   

    for (int index = 0; index < A_SIZE; index++){ //loop through each student grade letter

        switch(studGradeLetter[index]){

            //Increment appropriate counter for each grade letter

            case 'A': A_grade_count++; break;

            case 'B': B_grade_count++; break;

            case 'C': C_grade_count++; break;

            case 'D': D_grade_count++; break;

            case 'F': F_grade_count++; break;

        }

    }

   

    //displaying the counter in the output report.

    cout <<"\n\nNumber of students with 'A' grade: " << A_grade_count;

    cout <<"\nNumber of students with 'B' grade: " << B_grade_count;

    cout <<"\nNumber of students with 'C' grade: " << C_grade_count;

    cout <<"\nNumber of students with 'D' grade: " << D_grade_count;

    cout <<"\nNumber of students with 'F' grade: " << F_grade_count;

}

/***********************************************************

* Function to calculate the total number of students

* approved or failed

* Argument: studGradeLetter array

* Return Value: None

* *********************************************************/

void CalculateApprovedFailedStudents(char studGradeLetter[])

{

    int total_approved = 0;

    int total_failed = 0;

    float percentage_approved;

    float percentage_failed;

    for (int index = 0; index < A_SIZE; index++){ //loop through each student grade letter

        if (studGradeLetter[index] == 'F') //If grade letter if 'F', increment total_failed

            total_failed++;

        else

            total_approved++; //else increment total_approved

    }

   

    //calculate percentage of Approved and Failed Students

    percentage_approved = (total_approved * 100)/ A_SIZE;

    percentage_failed = (total_failed * 100)/ A_SIZE;

   

    //Displaying the result in numeric format and percentage

    cout <<"\n\nNumber of Approved Students: " << total_approved;

    cout <<"\nNumber of Failed Students: " << total_failed;

    cout <<"\nPercentage of Approved Students: " << percentage_approved <<"%";

    cout <<"\nPercentage of failed Students: " << percentage_failed <<"%";

   

}

/******************************************************************

* Function to search for the student (s) with the highest grade.

* Argument: studID, studName, studGrade and studGradeLetter array

* Return Value: None

* ***************************************************************/

void SearchHighestGradeStudents(int studID[], string studName[], int studGrade[], char studGradeLetter[])

{

    cout <<"\n\nStudents with the highest grade 'A': " << endl;

   for (int index = 0; index < A_SIZE; index++){ //loop through each student grade letter

        if (studGradeLetter[index] == 'A') //If grade letter if 'A', dislay the student details

            cout << studID[index] << ' ' << studName[index] << ' ' << studGrade[index] << ' ' << studGradeLetter[index] << endl;

    }

}

/******************************************************************

* Function to calculate the general average of the course

* Argument: studGrade array

* Return Value: None

* ***************************************************************/

void CalculateGeneralAverage(int studGrade[])

{

    float total_grade = 0;

    float average;

    for (int index = 0; index < A_SIZE; index++){ //loop through each student grade Value

        total_grade = total_grade + studGrade[index]; //add the grade value to total_grade

    }

    average = total_grade/A_SIZE; //calculating the average of course

   

    //Displaying the average in output report

    cout <<"\nAverage of the course: " << average;

}

OUTPUT:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
The following program allows the user to enter the grades of 10 students in a class...
The following program allows the user to enter the grades of 10 students in a class in an array called grade. In a separate loop, you need to test if a grade is passing or failing, and copy the grade to an array to store passing or failing grades accordingly. A passing grade is a grade greater than or equal to 60. You can assume the use will enter a grade in the range of 0 to 100, inclusive. ...
C++ //StudentDataStructure.txt //Student records are stored in a parallel-array Data Structure. Here is the code to...
C++ //StudentDataStructure.txt //Student records are stored in a parallel-array Data Structure. Here is the code to generate and populate Parallel-Array Data Structure: const int NG = 4; //Number of Grades string names[] = {"Amy Adams", "Bob Barr", "Carla Carr", "Dan Dobbs", "Elena Evans" }; int exams[][NG]= { {98,87,93,88}, {78,86,82,91}, {66,71,85,94}, {72,63,77,69}, {91,83,76,60} };    --------------------------------------------------------------------------------- 1 A) Create and Populate a Parallel-Array Data Structure using the code described in "StudentDataStructure.txt". B) Define a Record Data Structure for student records. It...
Assignment #4 – Student Ranking : In this assignment you are going to write a program...
Assignment #4 – Student Ranking : In this assignment you are going to write a program that ask user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’...
Write a Java program to display a letter grade based on an actual grade. A =...
Write a Java program to display a letter grade based on an actual grade. A = 90-100 B = 80-89 C = 70-79 D = 60-69 F = less than 60 The program needs to do the following: 1. Create a short integer to store a grade. (See Week 3 - Things to Know - Java Data Types ) 2. Prompt for a grade ( 0-100). 3. Based on the grade given, use IF statements to display the letter grade...
Functions displayGrades and addGrades must be rewritten so that the only parameters they take in are...
Functions displayGrades and addGrades must be rewritten so that the only parameters they take in are pointers or constant pointers. Directions: Using the following parallel array and array of vectors: // may be declared outside the main function const int NUM_STUDENTS = 3; // may only be declared within the main function string students[NUM_STUDENTS] = {"Tom","Jane","Jo"}; vector <int> grades[NUM_STUDENTS] {{78,98,88,99,77},{62,99,94,85,93}, {73,82,88,85,78}}; Be sure to compile using g++ -std=c++11 helpWithGradesPtr.cpp Write a C++ program to run a menu-driven program with the...
Using python, write the program below. Program Specifications: You are to write the source code and...
Using python, write the program below. Program Specifications: You are to write the source code and design tool for the following specification: A student enters an assignment score (as a floating-point value). The assignment score must be between 0 and 100. The program will enforce the domain of an assignment score. Once the score has been validated, the program will display the score followed by the appropriate letter grade (assume a 10-point grading scale). The score will be displayed as...
Need someone to fix my code: #include<iostream> using namespace std; struct student { double firstQuizz; double...
Need someone to fix my code: #include<iostream> using namespace std; struct student { double firstQuizz; double secondQuizz; double midTerm; double finalTerm; string name; }; int main() { int n; cout<<"enter the number of students"<<endl; cin>>n; struct student students[n]; int i; struct student istudent; for(i=0;i<n;i++) {    cout<<"Student name?"; cin >> istudent.name; cout<<"enter marks in first quizz , second quizz , mid term , final term of student "<<i+1<<endl; cin>>students[i].firstQuizz>>students[i].secondQuizz>>students[i].midTerm>>students[i].finalTerm; } for(i=0;i<n;i++) { double marks=0; double score=students[i].firstQuizz+students[i].secondQuizz+students[i].midTerm+students[i].finalTerm; marks=(students[i].firstQuizz*0.25)+(students[i].secondQuizz*0.25)+(students[i].midTerm*0.25)+(students[i].finalTerm*0.50); double totalArrgegateMarks =...
Topics Arrays Accessing Arrays Description Write a C++ program that will display a number of statistics...
Topics Arrays Accessing Arrays Description Write a C++ program that will display a number of statistics relating to data supplied by the user. The program will ask the user to enter the number of items making up the data. It will then ask the user to enter data items one by one. It will store the data items in a double array. Then it will perform a number of statistical operations on the data. Finally, it will display a report...
Java: A teacher has five students who have taken four tests. The teacher uses the following...
Java: A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores: Test Score Letter Grade 90–100 A 80–89 B 70–79 C 60–69 D 0–59 F Write a class that uses a String array (or an ArrayList object) to hold the five students’ names, an array of five characters to hold the five students’ letter...
You are to write a program that will process students and their grades. For each student...
You are to write a program that will process students and their grades. For each student the program will read in a student’s name. It should also read in 10 test scores for the student and calculate his or her average. You must read the scores using a loop. The program should output the student’s name, average and letter grade. The average should be displayed accurate to 1 decimal digit. Letter grades are assigned based on the scale: 90-100    A...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT