Homework2-4 - 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 DocumentRight 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&quot;); //finds out what letter grade the user wants to end up with printf(&quot;\nPlease enter your desired letter grade.\n&quot;); scanf(&quot;%c&quot;, &amp;letter); //gets minimum average needed to obtain desired letter grade printf(&quot;\nEnter minimum average required for a %c &gt; &quot;, letter); scanf(&quot;%lf&quot;, &amp;avg_req); //gets users current average printf(&quot;\nEnter your current class average.\n &gt; &quot;); scanf(&quot;%lf&quot;, &amp;cnt_avg); //gets percentage that final exam counts towards course grade printf(&quot;\nEnter how much the final exam counts as a percentage\n of the overall course grade.&gt; &quot;); scanf(&quot;%lf&quot;, &amp;grd_wt); grd_wt = grd_wt/100; //calculation of needed grade gd_need = (avg_req - cnt_avg)/grd_wt; if (gd_need &lt; 100) { printf(&quot;\nYou will need a %5.2lf in order to get a %c .&quot;, gd_need, letter); } else { printf(&quot;I'm sorry, it's just not possible for you get a %c in this class.&quot;, letter); } return (0); }...
View Full Document

Page1 / 2

Homework2-4 - simple questions first. ..Lets get...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online