Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; int main(void) { const int NUM_ASSIGNMENT = 10; const int NUM_STUDENTS = 30; int numOfAssignments = 0; int numOfStudents; int

image text in transcribed

#include

#include

using namespace std;

int main(void) {

const int NUM_ASSIGNMENT = 10;

const int NUM_STUDENTS = 30;

int numOfAssignments = 0;

int numOfStudents;

int assignments[NUM_STUDENTS][NUM_ASSIGNMENT];

string studentNames[NUM_STUDENTS];

string assignmentNames[NUM_ASSIGNMENT];

cout

cin >> numOfStudents;

if (numOfStudents > 30) {

numOfStudents = 30;

cout

}

for (int i = 0; i

cout

cin >> studentNames[i];

}

char command_choice = ' ';

while (command_choice != 'q') {

system("CLS");

// Output ggradebook

cout

for (int i = 0; i

cout

}

cout

for (int i = 0; i

cout

if (studentNames[i].size()

cout

}

for (int j = 0; j

cout

}

cout

}

cout

cin >> command_choice;

system("CLS");

string input_name;

switch (command_choice) {

case 's':

cout

cin >> studentNames[numOfStudents];

for (int i = 0; i

cout

cin >> assignments[numOfStudents][i];

}

numOfStudents++;

break;

case 'a'://checking the condition of nnumber of assignment

if (numOfAssignments

cout

cin >> assignmentNames[numOfAssignments];

for (int i = 0; i

cout

cin >> assignments[i][numOfAssignments];

}

numOfAssignments++;

}

else {

cout

}

break;

case 'e':

cout

cin >> input_name;

//find the index of the student in the 2d array of assignments and stored it in row variable

int row, col;

for (int i = 0; i

{

if (studentNames[i] == input_name) {

row = i;

break;

}

}

cout

cin >> input_name;

//find the index of the student in the 2d array of assignments and stored it in col variable

for (int i = 0; i

{

if (assignmentNames[i] == input_name) {

col = i;

break;

}

}

int new_value;

cout

cin >> new_value;

assignments[row][col] = new_value;

break;

case'c': {int assignmentToCurve = -1;

cout

cin >> assignmentToCurve;

//adjust for arrays starting at 0;

assignmentToCurve--;

int sum = 0;

for (int i = 0; i

sum += assignments[i][assignmentToCurve];

}

float average = (float)sum / numOfStudents;

if (average

for (int i = 0; i

assignments[i][assignmentToCurve] += (70 - average);

}

cout

}

break;

}

case'q':break;

default:

cout

break;

}

}

return 0;

}

In this quest, you are going to modify quest 5 so that it saves your class roster to a file and can load from that file. 1. When you first start the program you should ask if they want to load a file or enter new information! Do not ask for a file name. The file name should be hard coded into your program! o 2. Remember that Quest 5 had you first ask for input. When the program comes up the user should have the option of loading from a file or manually input a new class. o If the user chooses to load from a file, but there is no file available, it should output a message saying as much and revert to manual input. 3. When the user chooses the quit menu item the current grade book should be saved to the file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

What is human nature?

Answered: 1 week ago