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
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...
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 =...
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 C++ program that would report all of the Min and Max. example: 1. 95...
Write a C++ program that would report all of the Min and Max. example: 1. 95 2. 95 3. 80 4. 80 lowest 80 on test(s): 3, 4 highest 95 on test(s): 1, 2 I have started it, however, this only outputs one of the Min and Max and not all of the other instances. #include<iostream> using namespace std; int main() { int grades[10] , min , max , minIndex , maxIndex ; int n , choice , rt ,...
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...
Create a program to calculate and print basic stats on a set of a given input...
Create a program to calculate and print basic stats on a set of a given input values representing students' scores on an quiz. 1) Ask the user for the total number of quiz scores to be input (assume a positive integer will be given). 2) Create an array to hold all the quiz scores and then get all the scores from input to put into the array. For example, if the user input 10 in step (1) then you should...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF A RUNNING COMPILER QUESTION: 1) Fibonacci sequence is a sequence in which every number after the first two is the sum of the two preceding ones. Write a C++ program that takes a number n from user and populate an array with first n Fibonacci numbers. For example: For n=10 Fibonacci Numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 2): Write...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop a class, using templates, to provide functionality for a set of recursive functions. The functions specified as recursive must be written recursively (not iterativly). The UML class specifications are provided below. A main will be provided. Additionally, a make file will need to be developed and submitted. ● Recursion Set Class The recursion set template class will implement the template functions. recursionSet -length: int...
JAVA Exercise_Pick a Card Write a program that simulates the action of picking of a card...
JAVA Exercise_Pick a Card Write a program that simulates the action of picking of a card from a deck of 52 cards. Your program will display the rank and suit of the card, such as “King of Diamonds” or “Ten of Clubs”. You will need: • To generate a random number between 0 and 51 • To define two String variables: a. The first String should be defined for the card Suit (“Spades”, “Hearts”, “Diamonds”, “Clubs”) b. The second String...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT