Here is the program:
#include <stdio.h>
#define HW 35
#define LAB 60
#define MID 200
#define FINAL 150
#define LECTQ 50
#define LABQ 60
int main (void)
{
float hw;
float lab;
float mid;
float final;
float lectq;
float labq;
float hwp;
float labp;
float midp;
float finalp;
float lectqp;
float labqp;
float hwpt;
float labpt;
float midpt;
float finalpt;
float lectqpt;
float labqpt;
float total;
printf("Enter the percentage of points earned on homework assignments: ");
scanf("%f", &hw);
printf ("Enter the percentage of points earned on lab assignments: ");
scanf("%f", &lab);
printf("Enter the percentage of points earned on the midterms: ");
scanf("%f", &mid);
printf("Enter the percentage of points earned on the final exam: ");
scanf("%f", &final);
printf("Enter the percentage of points earned on the lecture quizzes: ");
scanf("%f", &lectq);
printf("Enter the percentage of points earned on the lab quizzes: ");
scanf("%f", &labq);
hwp = hw * 100;
labp = lab * 100;
midp = mid * 100;
finalp = final * 100;
lectqp = lectq * 100;
labqp = labq * 100;
hwpt = HW * hw;
labpt = LAB * lab;
midpt = MID * mid;
finalpt = FINAL * final;
lectqpt = LECTQ * lectq;
labqpt = LABQ * labq;
total = hwpt + labpt + midpt + finalpt + lectqpt + labqpt;
printf("\n============ Semester Results ============\n");
printf("Homework: %10.2f%% Points Earned: %6.2f\n", hwp, hwpt);
printf("Labs: %14.2f%% Points Earned: %6.2f\n", labp, labpt);
printf("Midterms: %10.2f%% Points Earned: %6.2f\n", midp, midpt);
printf("Final Exam: %8.2f%% Points Earned: %6.2f\n", finalp, finalpt);
printf("Lecture Quiz: %6.2f%% Points Earned: %6.2f\n", lectqp, lectqpt);
printf("Lab Quiz: %10.2f%% Points Earned: %6.2f\n", labqp, labqpt);
printf("===========================================\n");
printf("====================== Total Points: %.2f\n", total);
[B] [SIZE=4]Question!!![/SIZE][/B] // printf("====================== Course Grade:
return(0);
}Notice the line I commented out right before return(0), I have no clue how to determine the letter grade. The boundaries are:Grade Total Points
A 470
B 415
C 360
D 305
Our professor asks not to use any conditional statement like "if" "elseif". Otherwise, it will be a zero. Is there anything way I can determine the grade without using conditional statements?
Edited by Alexander, 26 January 2011 - 11:39 PM.
Added bb [code] tags


Sign In
Create Account


Back to top









