Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

12.12 Grade Calculator The following program should compute a student's total course percentage based on scores on four items of different weights: 10% Homeworks (out

12.12 Grade Calculator The following program should compute a student's total course percentage based on scores on four items of different weights: 10% Homeworks (out of 80 points) 30% Midterm exam (out of 40 points) 45% Final exam (out of 70 points) 15% Quizzes (out of 20 points) INPUT: 78 36 62 16 OUTPUT: Enter homework score: Enter midterm exam score: Enter final exam score: Enter quiz score: CATEGORY POINTS MAX PERCENT WEIGHT WEIGHTED PERCENT HOMEWORK QUIZ FINAL QUIZ 78.00 36.00 62.00 16.00 80.00 40.00 70.00 20.00 97.5% 90.0% 88.6% 80.0% 10.0% 30.0% 45.0% 15.0% 9.88 27.0% 39.9% 12.0% COURSE 88.6% LAB ACTIVITY 12.12.1: Grade Calculator 0/14 0 LAB ACTIVITY 12.12.1: Grade Calculator 0/14 main.c Load default template... 1 #include 3 double CalcRow(char category[], double score, double max, double weight) double rowScore = score / max * weight; // TODO: print out category in leftjustifed, width 8 field RED 0 von WN printf("%8.21f", score); // TODO: print out max in right-justified, width 8, precision 2 field printf("%8.11F%%", score/max * 100); // double %% prints out real % // TODO: print out weight in right-justified, width 8, precision 1 field, followed by a percent symbol // (be sure to multiple by 100 to change to a percentage) 16 17 printf("%8.12f%%", rowScore * 100); printf(" "); return rowScore; 201 21 22 int main(void) { const double HOMEWORK_MAX = 80.0; const double MIDTERM_MAX = 40.8; const double FINAL_MAX = 70.0; const double HOMEWORK_WEIGHT = 0.10; const double MIDTERM_WEIGHT = 0.30; const double FINAL_WEIGHT = 0.45; // TODO: add MAX and WEIGHT constants for QUIZ double homeworkScore, midtermScore, final Score, quizScore; double coursePercentage; printf("Enter homework score: "); scanf ("%f", &homeworkScore); printf("Enter midterm exam score: "); scanf ("%f", &midtermScore); 40 printf("Enter final exam score: "); scanf ("%f", &final Score); // TODO: prompt for and enter quizScore 44 coursePercentage = 0; printf("CATEGORY POINTS MAX PERCENT WEIGHTWEIGHTED PERCENT "); printf("-- - ---- " : coursePercentage += CalcRow("HOMEWORK", homeworkScore, HOMEWORK_MAX, HOMEWORK_WEIGHT): // TODO: add on to coursePercentage for the other three categories 52 printf(". --------------- "); printf("COURSE %43.11f%% ", coursePercentage * 100); 54 return ; 55 } 56

C Programming 12.12 Grade Calculator

3 double CalcRow(char catego" v:shapes="Picture_x0020_25">

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Usability

Authors: Jakob Nielsen, Raluca Budiu

1st Edition

0133122131, 9780133122138

More Books

Students also viewed these Programming questions