ok, don't mean to be long but i need help with a program and i want to give all the necessary information. I have coded the program however, am having problems with it. Here is the program:
Write a program that accepts a student identification number and three test scores, test1, test2, and final_test, as input and then determine outputs for each student the semester average and the final letter grade according to the following scheme:
Semester Average Final Letter Grade
90-100 A
80-89 B
70-79 C
60-69 D
0-59 F
The semester average for students is computed using the following formula: semester_average =0.2.*test1+0.30*test2+0.50*final_test
students identification numbers are nonzero integers. Input should terminate when the instructor types 0 for student identification number. The instructor also wants a distribution of letter grades and a class average. Class average is computed using the following formula:
clas_average=(4* number_of_A_grades +3*number_of_B_gardes+2*number_of_C_grades+1*numbe r_of_D_grades)/number_of_students. This is all the required information now here is my code and as always thanks for all the help!!!!!!!!!!!!!!!!!!!
#include <stdio.h>
int main (void) {
/* Variable declarations: */
double grade;
/* Function body: */
printf ( "A program that prints letter grades\n");
printf ( "Enter grade\n");
scanf ( "%1f", &grade);
if (grade >= 90)
printf ( "Grade = 'A' ");
else if (grade >= 80)
printf ( "Grade = 'B'");
else if (grade >= 70)
printf ( "Grade = 'C'");
else if (grade >= 60)
printf ( "Grade = 'D'");
else
printf ( "Grade = 'F'");
/* end if*/
return grade;
} /* end function main*/
Sample program design according to the book:
****> Enter student idno: 1100
****> Enter test score 1: 70
****> Enter test socre 2: 80
****> Enter final score: 100
Semester average for student 1100: 88
Letter grade for student 1100 : B
****> Enter studnt idno: 1200
****> Enter test socre 1: 75
****> Enter test score 2: 65
****> Enter final score: 76
Semester averag for student 1200: 73
Letter grade for student 1200 : C
****> Enter student idno: 0
Grade distributions:
A 4
B 6
C 7
D 2
F 0
Class Average: 2.63