Question

Write a C++ program to keep records and perform statistical analysis for a class of 20...

Write a C++ program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex, quizzes Scores (2 quizzes per semester), mid-term score, final score, and total score.


The program will prompt the user to choose the operation of records from a menu as shown below:
==============================================

                                           MENU

===============================================


1. Add student records

2. Delete student records

3. Update student records

4. View all student records

5. Calculate an average of a selected student’s scores

6. Show student who gets the max total score

7. Show student who gets the min total score

8. Find student by ID

9. Sort records by total scores


Enter your choice:1
  
Note: All students records store in an array of structures

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

According to Chegg rules, I can do fist 4 points.

Please go through code and output.

CODE:

#include <iostream>

#include <string>

using namespace std;

#define MAX 20 // maximun student record macro

/* structure */

typedef struct student {

int ID;

string name;

string sex;

int quizzesScores1;

int quizzesScores2;

}ST;

void printMenu(void) // print manu

{

cout << "1. Add student records\n2. Delete student records\n3. Update student records\n4. View all student records\n5. 5. Calculate an average of a selected student’s scores\n6. Show student who gets the max total score\n7. Show student who gets the min total score\n8. Find student by ID\n9. Sort records by total scores" << endl;

}

void add(ST * s) // add record

{

cout << "Enter ID Name Sex quizScore1 quizScore2: ";

cin >> s->ID >> s->name >> s->sex >> s->quizzesScores1 >> s->quizzesScores2 ;

}

bool deleteRecord(int ID, ST array[],int count) // delete record

{

for(int i=0; i<count; i++)

{

if(array[i].ID == ID)

{

for(int j = i; j< count-1 ; j++)

{

array[j] = array[j+1];

}

return true;

}

}

return false;

}

/* update record */

bool update(int ID, ST array[], int count)

{

for(int i=0; i<count; i++)

{

if(array[i].ID == ID) // find id

{

cout << "Enter Name Sex quizScore1 quizScore2: ";

cin >> array[i].name >> array[i].sex >> array[i].quizzesScores1 >> array[i].quizzesScores2 ;

return true;

}

}

return false;

}

int main()

{

int choice = 0;

ST array[20];

int count = 0;

int ID;

while(1)

{

printMenu();

cin >> choice;

switch(choice)

{

case 1 : // add student record

add(&array[count]);

count++;

break;

case 2: // delete student record based on ID

cout << "Enter ID ";

cin >> ID;

if(true == deleteRecord(ID, array, count))

{

count--;

}

else

{

cout << "ID not found" << endl;

}

break;

case 3: // update student record based on ID

cout << "Enter ID: ";

cin >> ID;

if(true == update(ID, array, count))

{

cout << "Updated successfully" << endl;

}

else

{

cout << "Update unsuccessful" << endl;

}

break;

case 4: // print add records

for(int i=0 ; i< count; i++)

{

cout << "ID : " << array[i].ID << endl;

cout << "Name : " << array[i].name << endl;

cout << "Sex :" << array[i].sex << endl;

cout << "Quiz 1 : " << array[i].quizzesScores1 << endl;

cout << "Quiz 2 : " << array[i].quizzesScores2 << endl;

}

break;

}

}

}

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
Write a C++ program to keep records and perform statistical analysis for a class of 20...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program to keep records and perform statistical analysis for a class of 20...

    Write a C++ program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex, quizzes Scores (2 quizzes per semester), mid-term score, final score, and total score.

  • Can somebody make this program in C or C++ for me please? I have 2 hours...

    Can somebody make this program in C or C++ for me please? I have 2 hours left so I have to get it done Write a C++ program to keep records and compute for the scores of 5 players. The information of each player contains: Nickname, Age and two best played scores. The program will prompt the user to choose the operation of records from a menu as shown below: ==============================================                                            MENU ============================================== Add record View players records Compute...

  • This is a java homework for my java class. Write a program to perform statistical analysis...

    This is a java homework for my java class. Write a program to perform statistical analysis of scores for a class of students.The class may have up to 40 students.There are five quizzes during the term. Each student is identified by a four-digit student ID number. The program is to print the student scores and calculate and print the statistics for each quiz. The output is in the same order as the input; no sorting is needed. The input is...

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks 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’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

  • c++ The program will be recieved from the user as input name of an input file...

    c++ The program will be recieved from the user as input name of an input file and and output.file. then read in a list of name, id# and score from input file (inputFile.txt) and initilized the array of struct. find the student with the higher score and output the students info in the output file obtain the sum of all score and output the resurl in output file. prompt the user for a name to search for, when it find...

  • Write a complete C++ program that reads students names and their test scores from an input...

    Write a complete C++ program that reads students names and their test scores from an input text file. The program should output each student’s name followed by the test scores and the relevant grade in an output text file. It should also find and display on screen the highest/lowest test score and the name of the students having the highest/lowest test score, average and variance of all test scores. Student data obtained from the input text file should be stored...

  • Write a C++ program that defines a structure called StudentInfo for records consisting of a student’s...

    Write a C++ program that defines a structure called StudentInfo for records consisting of a student’s ID, age, final grade for math, final grade for reading, and final grade for music. Define an array of such records to hold up to eight students’ records that the user input students’ information from the keyboard. Then compute and print out the average of their math grades and average of reading, and each student’s average grade of math, reading and music .

  • Assignment Write a menu-driven C++ program to manage a class roster of student names that can...

    Assignment Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students...

  • Write a menu-driven C++ program to manage a class roster of student names that can grow...

    Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students Q...

  • In C++, write a complete program that receives a series of student records from the keyboard...

    In C++, write a complete program that receives a series of student records from the keyboard and stores them in three parallel arrays named studentID and courseNumber and grade. All arrays are to be 100 elements. The studentID array is to be of type int and the courseNumber and grade arrays are to be of type string. The program should prompt for the number of records to be entered and then receive user input on how many records are to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT