Question: main.c Need help writing these functions based on main.c but output is according to the chart listed after functions.c Column Weight Percentage Score Range L1

main.c

main.c Need help writing these functions based on main.c but output isaccording to the chart listed after functions.c Column Weight Percentage Score RangeL1 through L10 1% for each lab 0-100 B1 through B10 1%

Need help writing these functions based on main.c but output is according to the chart listed after functions.c

for each zyBooks exercise 0-100 P1 through P6 2% for P1 5%

Column Weight Percentage Score Range
L1 through L10 1% for each lab 0-100
B1 through B10 1% for each zyBooks exercise 0-100
P1 through P6 2% for P1 5% each for P2, P3 6% each for P4, P5, P6 0-100
E1 through E4 10% each for E1, E2, E3 20% for E4 0-100

each for P2, P3 6% each for P4, P5, P6 0-100 E1

Sample Output:

Enter a command: min B1 min(B1)=10.7

Enter a command: max B5 max(B5)=100

Enter a command: count E4 60 count(E4>=60)=44

Enter a command: grade Louanne Fisch grade(Louanne Fisch)=68.437

Enter a command: quit

1 2 3 4 5 6 7 8 9 #include #include #include #include #include // Given a gradebook file, return the minimum of the specified column, excluding unavailable scores double getMin(char filenane (), char column []); // Given a gradebook file, return the maximum of the specified column, excluding unavailable scores double getMax (char filename [], char column[]); // Given a gradebook file, return the average of the specified column, excluding unavailable scores double getAvg(char filename[], char column []); // Given a gradebook file, return the number of students with their column value >= threshold, excluding unavailable scores int getCount(char filenamel), char column[], double threshold); // Given a gradebook file, return the weighted average of the specified student // or -1.0 if there is no such student. // An unavailable score is viewed as a double getGrade(char filename[], char first[], char last[]); 18 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 38 31 32 33 34 35 36 37 38 39 40 41 int isValidColumn(char column[]) { char type; int nun sscanf(column, "d", &type, Enum); switch (type) case 'L': if (nun18) return; break; case 'E': if (nun) return; break; case 'B': if (nun10) return; break; case 'P if (nun6) return; break; default: return 0; } 42 43 44 45 46 47 48 49 char column2 [strlen(column)+1]; sprintf(column2, "cd", type, num); if (strcmp(column, column2) !=0) return; return 1; 58 51 52 } 53 54 55 56 57 58 59 68 61 62 63 64 65 66 67 68 69 void printHelp) { printf(" The valid connands: "); printf("\thin column "); printf("\tss find the minimum of the specified column, excluding unavailable scores "); printf("\t*** for example: min P4 "); printf("\tmax columnin"); printf("\t*** find the maximum of the specified column, excluding unavailable scores "); printf("\t*** for example: max E1 "); printf("\tavg column "); printf("\ts** find the average of the specified column, excluding unavailable scores "); printf("\t*** for example: avg B10 "); printf("\tcount column threshold "); printf("\t*** find the number of rows with its column value >= threshold, excluding unavailable scores "); printf("\tsss for example: count L2 68 "); printf("\tgrade firstnane lastname "); printf("\t*** find the weighted average of the specified student. An unavailable score is viewed as 0 "); printf("\ts** for example: grade John Smith "); printf("\tquit "); printf("\t*** quit this program "); printf("\thelp "); printf("\t*** print this list "); } 71 72 73 74 int main(int argc, char *argv[] ) { 76 77 78 79 Be 81 82 83 84 85 86 87 88 89 98 91 if (argc!=2) { printf("Usage: ks filename ", argv[@]); return 1; } FILE *fp=fopen(argv[i], "r"); if (fp==NULL) { printf("Unable to open As for reading ", argv[i]); return 2; } fclose(fp); 92 93 94 95 96 97 98 99 188 101 102 183 184 105 106 107 188 189 while (1) { char cnd (30); char column (30); char line (388); printf(" Enter a connand: "); scanf("%s", cnd); if (strcmp(cnd, "quit")==8) break; if (strcmp(cnd, "grade") = 0) { char first[30], last (36); scanf("s", first, last); double grade=getGrade (argv[i], first, last); if (grades=) printf("grade(45 %:s) = ", first, last, grade); else printf("No student named es es ", first, last); } else if (strcmplcnd, "min")==0) { scanf("s", column); if (isvalidColumn(column)) { double nin=getMin(argv[i], column); 189 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 138 131 132 133 134 135 136 137 138 139 140 141 142 143 double nin=getMin(argv[i], column); printf("min(as) = ",column, min); } else { printf("%s: invalid column name. ", column); fgets(line, 388, stdin); // skip the rest of line } } else if (strcmp(cnd, "max")==0) { scanf("s", column); if (isvalidColumn(column)) { double max=getMax(argv[1], column); printf("max(45)=rg ", column, max); } else { printf("%s: invalid column name. In", column); fgets(line, 308, stdin); // skip the rest of line } } else if (strcmp(cnd, "avg") ==0) { scanf("s", column); if (isvalidColumn(column)) { double avg=getAvg(argv[1], column); printf("avg(ms)=#g ", column, avg): ) else { printf("%s: invalid column name. ", column); fgets(line, 300, stdin); // skip the rest of line } } else if (strcmp(cnd, "count")==0) { scanf("s", column); if (isvalidColumn(column)) { double threshold; scanf("16", &threshold); int count=getCount(argv[i], column, threshold); printf("count(*)=d ", column, threshold, count); } else { printf("*: invalid column name. In", column); fgets(line, 388, stdin); // skip the rest of line } } else if (strcmp(ond, "help") ==0) { printHelp(); } else { printf("%s: invalid command. Type help for help. ", cond); fgets(line, 308, stdin); // skip the rest of line } } return; 144 145 146 147 148 149 158 151 152 153 154 155 156 157 158 159 168 161 } #include #include #include #include #include // Given a gradebook file, return the minimum of the specified column, excluding unavailable scores double getMin(char filename[], char column []) { return 1.1; } // Given a gradebook file, return the maximum of the specified column, excluding unavailable scores double getMax(char filename[], char column (1) { return 2.2; } // Given a gradebook file, return the average of the specified column, excluding unavailable scores double getAvg(char filename[], char column[]) { return 3.3; } // Given a gradebook file, return the number of students with their column value >= threshold, excluding unavailable scores int getCount(char filename[], char column[], double threshold) { return 4; } // Given a gradebook file, return the weighted average of the specified student // or -1.0 if there is no such student. // An unavailable score is viewed as a double getGrade(char filename[], char first[], char last[]) return -1.0; // not exist ] 100 100 54 90 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 First Last P1 L1 B1 P2 L2 B2 L3 B3 E1 P3 L4 B4 L5 El P3 L4 B4 L5 L6 P4 B5 B6 E2 L7 B7 P5 L8 L9 P6 E3 B8 L10 B9 B10 E4 Lloyd Gibbon 188 188 100 100 95 100 86 100 100 100 100 100 100 95 100 100 100 100 100 100 100 100 70 89 94 100 100 100 100 100 Eleonora Schlosser 97 32 99.2 97 85 95.9 54 93.5 24 82 90 93.5 90 100 97 87.3 94.9 92 100 97.6 100 100 100 5 86 97.6 Judith Tignor 3 100 99.2 100 95 100 86 100 95 20 62 106 106 86 100 100 100 78 100 100 96 100 100 95 94 100 100 100 100 97 Maida Mood 100 100 100 100 100 100 90 100 100 70 100 100 100 79 100 100 70 100 100 100 79 100 100 100 91 100 100 100 100 90 92 94 94 100 100 100 100 100 Kayla Bruner 100 100 100 88 95 100 86 95 100 86 100 100 80 30 100 100 100 75 100 100 79 100 100 3 100 100 74 83 100 100 100 100 81 Tajuana Galloway 93 100 100 100 90 100 86100 90 100 100 100 100 100 96 100 100 81 100 100 65 100 90 69 73 100 50 100 100 83 Shantae Carcamo 188 180 100 100 100 100 100 100 100 100 100 106 106 86 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 96 Gayle Tash 100 100 100 100 100 100 100 100 92 96 100 100 100 100 100 100 100 60 90 100 100 100 100 95 95 100 100 100 0 96 Keneth Cuesta 100 100 99.7 100 95 100 100 100 88 25 25 100 100 100 96 85 100 100 76 100 100 96 100 100 34 94 100 na 100 100 100 Evangelina Bozeman 100 100 100 100 95 100 93 100 100 25 188 188 188 65 100 100 100 65 100 100 100 100 100 100 100 100 100 97 100 100 100 100 100 71 Owen Moniz 100 100 10.7 100 96 97.9 100 100 92 100 100 100 100 100 90 100 93.2 100 100 100 97 188 188 96 88 100 100 100 46 100 Aurelio Alton 100 100 100 100 80 100 86 100 90 100 72 100 70 180 70 86 100 100 100 100 100 100 52 100 100 72 89 100 100 100 100 100 Marcene Rothenberg 100 100 100 100 100 100 86 100 100 85 58 58 100 100 100 0 100 100 44 100 100 10 100 100 88 70 100 100 100 100 55 Sharla Mattocks 100 90 98.6 100 100 100 100 100 100 95 100 100 70 108 108 70 100 96 100 100 94 100 100 100 100 100 91 100 100 60 100 100 69 Rob Pauls 100 100 100 96 100 100 100 100 100 100 93 100 100 100 98 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 Calandra Ungar 188 100 100 97 80 100 100 100 100 80 108 108 108 100 100 100 100 88 100 100 100 100 100 89 100 100 100 100 100 92 Deloris Schoenborn 100 100 99.2 93 100 99 86 96.3 70 82 180 85.6 100 72 na 95.2 0 91 100 100 100 90 95 58 81 100 100 100 0 87 Brigette Finney 94 86 87.9 91 91 98.5 54 100 95 12 12 96 100 65 79 100 97.6 100 64 100 100 100 100 40 77 82 100 na 100 100 100 Milissa Mobley 100 100 100 96 95 100 100 100 100 81 100 100 100 86 100 100 100 100 100 100 100 100 100 93 100 100 100 100 100 92 Huong Letson 97 100 100 100 95 99.5 86 100 85 40 98 100 15 79 098.8 100 82 100 100 60 100 98 53 108 98 53 100 100 100 100 100 97 Ella Wike 100 100 99.2 100 100 99.5 100 100 96 100 100 100 100 100 95 100 100 100 100 100 76 100 100 100 100 100 100 100 100 100 Buster Kisner 96 100 100 100 100 100 72 100 92 100 100 100 100 72 100 100 100 100 72 95 100 100 100 100 100 91 100 100 100 100 100 50 100 100 81 Stormy Beaufort 100 100 96.1 90 100 96.4 na 96.3 85 na na 0 100 86 100 91.5 082 198 198 100 100 100 na 94 100 100 100 100 96 Graig Reel 100 100 100 100 100 100 100 100 100 70 100 100 100 86 100 100 100 86 100 100 100 85 100 100 100 100 100 92 100 100 100 100 100 100 Rosy Hammontree 100 100 98.9 100 100 100 86 100 100 21 100 100 80 79 90 79 90 100 100 100 100 100 97 na 188 98 100 100 100 100 100 100 Armand Bladen 97 100 100 100 80 100 93 100 91 85 100 91 85 58 100 100 72 70 100 100 100 100 100 58 100 100 55 94 100 100 100 100 85 Francisco Masters 100 100 100 100 95 100 100 100 75 10 37 100 60 79 100 100 100 70 100 100 93 100 100 74 63 100 100 100 100 87 Aleida Francoeur 180 90 100 100 100 100 86 100 100 10 56 100 100 86 22 100 100 63 73 100 7 100 100 6 94 100 80 100 100 71 Nicola Alto 100 100 100 100 96 100 100 100 92 70 100 100 100 100 95 100 100 100 100 100 98 100 100 89 100 100 100 100 100 100 Dimple Whitson 198 98 100 100 100 98.5 100 100 100 85 100 100 100 100 100 100 98.3 100 70 100 100 100 100 92 100 100 10 100 100 100 Major Witherite 93 92 99.4 100 95 100 93 100 100 85 98 100 100 72 25 100 100 70 na 100 100 98 188 91 95 100 100 100 100 96 Louanne Fisch 97 88 98.3 94 41 97.4 100 100 50 25 78 108 85 50 100 100 100 38 100 100 95 108 95 58 82 100 100 100 100 51 Lan Mazon 97 198 100 100 95 100 79100 91 65 100 100 100 86 100 100 100 100 100 100 97 100 100 49 94 100 80 100 100 83 Elias Kasel 100 % 98.3 100 90 100 77 100 84 7 7 na 100 100 86 97.6 100 39 na 100 94 108 95 28 50 100 100 100 98 61 Kaley Pawlak 90 95 100 94 100 100 97 100 100 96 100 100 90 86 95 100 100 99 100 100 60 100 90 198 99 100 100 100 100 96 Amalia Neiss 97 100 100 94 95 97.4 86 98.1 95 85 72 99.3 60 93 100 95.2 93.2 76 188 188 48 100 100 69 36 100 100 100 92 62 Shanda Nicley 198 52 98.6 97 72 100 100 100 79 100 100 100 100 86 100 100 100 100 86 95 100 100 95 100 100 100 100 100 73 94 100 95 100 100 67 Harry Sessions 100 100 100 100 95 100 97 100 92 85 100 97 100 92 85 186 188 180 79 100 100 100 74 100 100 96 100 188 188 94 100 100 100 54 100 Jeannine Kleinman 100 na 100 96 100 99.5 100 100 89 18 17 100 100 100 100 95.2 100 64 100 100 79 100 100 46 99 100 70 100 0 92 Stacee Andres 88 100 100 93 95 98.5 17 100 70 22 77 91.5 90 93 na 93.9 78 76 76 100 100 35 100 950 32 100 100 100 0 83 Sherell Calabrese 100 100 100 100 100 100 86 100 95 65 86 100 70 86 100 100 100 82 100 100 100 100 100 96 100 100 100 100 100 100 Karan Bengtson 96 76 95.6 100 75 97.9 100 100 102 25 108 100 70 93 100 100 100 76 100 100 100 100 100 59 58 100 100 100 100 67 Merlin Shuford 100 100 100 100 100 100 58 100 100 100 100 100 100 100 96 100 100 100 100 100 100 100 96 100 100 100 100 100 100 100 100 100 100 100 100 100 100 96 Bill Fleckenstein 96 96 100 96 100 100 76 94.4 99 100 100 100 100 86 na 100 100 82 70 100 76 190 198 92 80 100 100 100 100 93 Jonathan Kisling 97 56 100 100 100 100 100 100 100 10 100 100 100 65 100 98.2 100 64 100 100 100 100 100 61 94 100 100 100 84 83 Valarie Tewksbury 100 100 100 100 90 100 86 100 100 96 48 99.3 80 100 85 100 100 64 100 100 90 100 188 78 79 100 50 100 100 88

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!