{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ENG_HW - simple questions first.Lets get...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework #2 /* * Program by Justin Waters * Inputs: desired grade, minimum avg, current avg, exam weight * Outputs: grade needed on the final for desired grade in class * Description: The user enters what grade he has and what grade he wants to end up with and the program calculates what the user needs on the final exam in order to achieve his goal. * */ #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> int main (void) { char letter; //users desired letter grade double avg_req; //average required for user to obtain desired grade double cnt_avg; //users current average double grd_wt; //weight of final towrds course grade double gd_need; //grade needed in order to obtain goal gd_need = 0; grd_wt = 0; cnt_avg = 0; avg_req = 0; /*tells the user what the program does*/ printf("\nThis program will tell you what score you will need\n on your final exam in order to get the final class grade you want.\n All you have to do is answer a few
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: simple questions first. ..Lets get started!\n"); //finds out what letter grade the user wants to end up with printf("\nPlease enter your desired letter grade.\n"); scanf("%c", &letter); //gets minimum average needed to obtain desired letter grade printf("\nEnter minimum average required for a %c > ", letter); scanf("%lf", &avg_req); //gets users current average printf("\nEnter your current class average.\n > "); scanf("%lf", &cnt_avg); //gets percentage that final exam counts towards course grade printf("\nEnter how much the final exam counts as a percentage\n of the overall course grade.> "); scanf("%lf", &grd_wt); grd_wt = grd_wt/100; //calculation of needed grade gd_need = (avg_req - cnt_avg)/grd_wt; if (gd_need < 100) { printf("\nYou will need a %5.2lf in order to get a %c .", gd_need, letter); } else { printf("I'm sorry, it's just not possible for you get a %c in this class.", letter); } return (0); }...
View Full Document

{[ snackBarMessage ]}