Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The logic needed here is complex!!! Pseudo code your logic first then work one p

ID: 3668830 • Letter: T

Question

The logic needed here is complex!!! Pseudo code your logic first then work one piece of the code at a time, Don't forget to ensure the validity of the input.

Create a program to handle a college class grades:

Capture the Teacher's name

Capture the Class designation

The program should ask how many students are in the class and do the following for each student:

Read the students name

Read in up to 10 grades for the student (from 0 - 100 is acceptable. If outside the range don't use the input, ask for a correction , 999 should stop input of grades if there are less than 10)

Calculate the average of the student's grades

Compute the student's grade as a letter grade

For the entire class

Compute the class's grade average

Determine how many A's, B's, C's, D's and F's are in the class.

Write the following data to a file called class_statistics.txt

Teacher: Bob Marley
Class: CGS1010
Student Name: Jim Beam Average: 88 Grade: B
Donna Jenner 95 A
Student count: 2
Student average: 91.5
A's: 1
B's: 1
C's: 0
D's: 0
F's: 0

Explanation / Answer

IF INPUT 1 ON THEN
SWITCH OFF 3 [traffic green light]
SWITCH ON 2 [traffic amber light]
WAIT 3
SWITCH OFF 2 [traffic amber light]
SWITCH ON 1 [traffic red light]
WAIT 2
SWITCH OFF 4 [pedestrian/cyclist red light]
SWITCH ON 5 [pedestrian/cyclist green light]
WAIT 20
SWITCH OFF 5 [pedestrian/cyclist green light]
SWITCH ON 4 [pedestrian/cyclist red light]
WAIT 5
SWITCH ON 2 [traffic amber light]
WAIT 5
SWITCH OFF 1 [traffic red light]
SWITCH OFF 2 [traffic amber light]
SWITCH ON 3 [traffic green light]
ENDIF

#include
#include

static int data[10000];

static int load(char *fname)
{
FILE *fp = fopen(fname, “r”);
int dc = 0;
int *dp = data;
if (fp)
{
while (fscanf(fp, “%d”, dp) > 0)
dp++;
dc = dp-data;
printf(“read %d values ”, dc);
}

return dc;
}

int main(int argc, char **argv)
{
int target = atoi(argv[2]);
int count = load(argv[1]);
int bot = 0;
int top = count-1;
int pivot;
int found = 0;

if (count == 0)
return -1;

while (!found && bot != top)
{
pivot = (bot+top)/2;
printf(“[%d] %d [%d] %d [%d] %d ”, bot, data[bot], pivot, data[pivot], top, data[top]);
if (target > data[pivot])
bot = pivot;
else if (target < data[pivot])
top = pivot;
else
{
printf("found %d at index %d ", target, pivot);
found = 1;
}
}

return found;
}