I am getting error. Would you please fill in the blanks from 1 to 57. // Import all the necessary libraries for printing and boolean usage #include #include<__1__> // Creating global variables for arrays and constant size __2__ int SIZE = 10; int int_grades[__3__]; char let_grades[__4__]; /* This function checks if a grade is in between 0 and 100, If it is, then return true, else return false Function takes no parameters and returns a boolean */ __5__ check_valid_grades(__6__ grade) { return (grade >= __7__ __8__ grade <= __9__) ? __10__ __11__ __12___ ; } /* The function loops through all students, get the inputs, and ONLY save grade to the integer grades array if the input is valid, If not, keep asking the user to reinput Function takes no parameters and returns no values */ __13__ input_grades() { for(int stud_idx = 0; stud_idx < SIZE; stud_idx++) { int user_input; scanf("%d", __14__); //Check for valid grades __15__ isValid = check_valid_grades(user_input); while(__16__isValid) //while isValid is false (not true), re-enter required { printf("Your input is invalid. Re-enter here: "); scanf("%d",&__17__); __18__ = check_valid_grades(__19__); } //Outside of while loop means the user input's grade IS valid, // save to the array int_grades[__20__] = __21__; } } /* This function converts all students integer grades to letter grades. int_grades array going to this function should contain ONLY valid grades. Save letter grades to let_grades array o A: 90 -> 100. o B: 80 -> 89 o C: 70 -> 79 o D: 60 -> 69 o F : below 60 Function takes no parameters and returns no values */ __22__ convert_to_letter_grades() { for(int i = 0; i < SIZE; i++) { int grade = int_grades[i]; //save time of typing int_grades[i], and for readability if(grade >= __23__) { __24__ = 'A'; } else if(grade >= __25__ __26__grade < __27__) { __28__ = 'B'; } else if(grade >= __29__ __30__ grade < __31__) { __32__ = 'C'; } else if(grade >= __33__ __34__ grade < __35__) { __36__ = 'D'; } else { __37__ = 'F'; } } } /* The function loops through all students. Find the sum of all students, and find the class average. Function takes no parameters and returns a float */ float get_average() { __38__ tot_grades = __39__; __40__ ave; for(int i = 0; i < SIZE; i++) { //update total sum by adding a int_grades array's element to current sum tot_grades __41__ __42__; } ave = __43__ / __44__; return ave; } /* The function returns true if a student gets a C or better (Pass) and false otherwise. All grades in the array are valid. Function takes 1 integer parameter and returns a boolean */ __45__ check_pass_fail(__46__ stu_idx) { __47__ let_gr = let_grades[__48__]; switch(let_gr) { case('A'): case(__49__): case(__50__): return __51__; default: return __52__; } } /* The function print the report for one student. This includes; - Their score - The letter grade - Pass/Fail status. All grades in the arrays are valid. Function takes 1 integer parameter and returns no values */ __53__ print_report_per_stu(int stu_idx) { printf("\nPrinting report for student #%d \n", stu_idx+1); __54__ isPass = check_pass_fail(__55__); printf("Original Score: %d, Letter Score: %c, Pass/Fail status: ",__56__, __57__); if(__58__) { printf("Passed.\n"); } else printf("Failed.\n"); } int main() { float class_average; printf("This class has %d students. Enter their final grades here: ", SIZE); input_grades(); //get grade inputs convert_to_letter_grades();//convert valid scores to letter grades class_average = get_average(); // get the average score printf("\n\nThe class's average is: %.2f\n", class_average); for(int i = 0; i < SIZE; i++) { print_report_per_stu(i); //print the report for each student } return 0;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I am getting error. Would you please fill in the blanks from 1 to 57.

// Import all the necessary libraries for printing and boolean usage

#include<stdio.h>

#include<__1__>

// Creating global variables for arrays and constant size

__2__ int SIZE = 10;

int int_grades[__3__];

char let_grades[__4__];

/* This function checks if a grade is in between 0 and 100, If it is, then return true, else return false Function takes no parameters and returns a boolean */

__5__ check_valid_grades(__6__ grade)

{ return (grade >= __7__ __8__ grade <= __9__) ? __10__ __11__ __12___ ; }

/* The function loops through all students, get the inputs, and ONLY save grade to the integer grades array if the input is valid, If not, keep asking the user to reinput Function takes no parameters and returns no values */

__13__ input_grades()

{

for(int stud_idx = 0; stud_idx < SIZE; stud_idx++)

{

int user_input;

scanf("%d", __14__);

//Check for valid grades

__15__ isValid = check_valid_grades(user_input);

while(__16__isValid)

//while isValid is false (not true), re-enter required

{

printf("Your input is invalid. Re-enter here: ");

scanf("%d",&__17__);

__18__ = check_valid_grades(__19__); }

//Outside of while loop means the user input's grade IS valid,

// save to the array

int_grades[__20__] = __21__;

}

}

/* This function converts all students integer grades to letter grades. int_grades array going to this function should contain ONLY valid grades. Save letter grades to let_grades array

o A: 90 -> 100.

o B: 80 -> 89

o C: 70 -> 79

o D: 60 -> 69

o F : below 60

Function takes no parameters and returns no values */

__22__ convert_to_letter_grades()

{

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

{

int grade = int_grades[i]; //save time of typing int_grades[i], and for readability

if(grade >= __23__)

{ __24__ = 'A'; }

else if(grade >= __25__ __26__grade < __27__)

{ __28__ = 'B'; }

else if(grade >= __29__ __30__ grade < __31__)

{ __32__ = 'C'; }

else if(grade >= __33__ __34__ grade < __35__)

{ __36__ = 'D'; }

else { __37__ = 'F'; }

}

}

/* The function loops through all students. Find the sum of all students, and find the class average. Function takes no parameters and returns a float */

float get_average()

{

__38__ tot_grades = __39__;

__40__ ave;

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

{

//update total sum by adding a int_grades array's element to current sum

tot_grades __41__ __42__;

}

ave = __43__ / __44__;

return ave; }

/* The function returns true if a student gets a C or better (Pass) and false otherwise. All grades in the array are valid. Function takes 1 integer parameter and returns a boolean */

__45__ check_pass_fail(__46__ stu_idx)

{

__47__ let_gr = let_grades[__48__];

switch(let_gr)

{

case('A'): case(__49__): case(__50__):

return __51__;

default: return __52__;

}

}

/* The function print the report for one student. This includes; - Their score - The letter grade - Pass/Fail status. All grades in the arrays are valid. Function takes 1 integer parameter and returns no values */

__53__ print_report_per_stu(int stu_idx)

{

printf("\nPrinting report for student #%d \n", stu_idx+1);

__54__ isPass = check_pass_fail(__55__);

printf("Original Score: %d, Letter Score: %c, Pass/Fail status: ",__56__, __57__);

if(__58__)

{

printf("Passed.\n");

}

else printf("Failed.\n");

}

int main()

{

float class_average;

printf("This class has %d students. Enter their final grades here: ", SIZE);

input_grades(); //get grade inputs

convert_to_letter_grades();//convert valid scores to letter grades

class_average = get_average(); // get the average score

printf("\n\nThe class's average is: %.2f\n", class_average);

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

{ print_report_per_stu(i); //print the report for each student

} return 0;

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Thank you for the quick respond. Even with the 'static' on line 5, I am getting error. Please see the attach picture. With #define I get whole bunch of erros. Would you please check it again.

E~/Lab7
1 #include<stdio.h>
#include<stdbool.h>
1 2 3
Ann
2
4
5
6
// Creating global variables for arrays and constant size
static int SIZE = 10;
int int_grades [SIZE];
char let_grades [SIZE];
7
8 /*
$ gcc 1.c
1.c:6:5: error: variably modified 'int_grades' at file scope
6 | int int_grades [SIZE];
Anne
1.c:7:6: error: variably modified ‘let_grades’ at file scope
7 | char let_grades [SIZE];
U
X
n 0 and 100-
e
polean
false;
Transcribed Image Text:E~/Lab7 1 #include<stdio.h> #include<stdbool.h> 1 2 3 Ann 2 4 5 6 // Creating global variables for arrays and constant size static int SIZE = 10; int int_grades [SIZE]; char let_grades [SIZE]; 7 8 /* $ gcc 1.c 1.c:6:5: error: variably modified 'int_grades' at file scope 6 | int int_grades [SIZE]; Anne 1.c:7:6: error: variably modified ‘let_grades’ at file scope 7 | char let_grades [SIZE]; U X n 0 and 100- e polean false;
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education