Its C programming Answer the question The following is a par
Its C programming
 Answer the question
The following is a part of a program that calculates an NFL Quarterback\'s Passer Rating.
#include <stdio.h>
 #include <stdlib.h>
float passerRating(int completions, int attempts, int tds, int interceptions, int yards);
 int getInt(char *prompt);   
int main(void)
 {
 int completions = 0, attempts = 0, tds = 0, interceptions = 0;
 int yards = 0;
 float rating = 0.0;
    
       while( 1 )
       {
             attempts = getInt(\"attempts\");
             if( attempts == 0 )
                   break;
             completions = getInt(\"completions\");
             tds = getInt(\"touchdowns\");
             interceptions = getInt(\"interceptions\");
             yards = getInt(\"yards\");
             rating = passerRating(completions, attempts, tds,
                                     interceptions, yards);
             printf(\"Rating is %.2f\ \", rating);
       }
       return 0;
 }
int getInt(char *prompt)
 {
 char buffer[81] = {0};
 int value = 0;
      printf(\"\ Enter %s: \", prompt);
       fgets(buffer, 81, stdin);
       value = atoi(buffer);
       return value;
 }
Write the code for the passerRating function. The formula for the passer rating is:
 a = (((completions / attempts) * 100) -30) / 20
 b = ((tds / attempts) * 100) / 5
 c = (9.5 - ((interceptions / attempts) * 100)) / 4
 d = ((yards / attempts) - 3) / 4
 If any of a, b, c or d are greater than 2.375, set that value to 2.375. Likewise, if any of a, b, c, or d are less than 0, set that value to 0.
passer rating = (a + b + c + d) / .06
 Assume that the user\'s entries will adhere to the following rules:
completions <= attempts
 tds <= completions
 interceptions <= attempts
 completions, tds, and interceptions are non-negative integers
 attempts is a positive integer
 yards is an integer
 Replace a, b, c, and d with more meaningful variable names (they will be marked). Do not unnecessarily duplicate code in the passerRating function (i.e. replace duplicated code with a function).
No commenting is necessary (even function comments).
You do have to indent and brace correctly and consistently.
The next section is not necessary for answering the question but ...
 If you\'re not familiar with football and you want to know about what these things are:
an attempt happens when a quarterback tries to throw the ball to a receiver
 a completion happens when a receiver catches a pass attempt (this is good)
 an interception happens when the opposing team catches a pass attempt (this is bad)
 a TD happens when the receiver catches a pass attempt for a touchdown (this is really good)
 yards indicates how far the pass completions went
 For example, if a quarterback did the following:
pass attempt that was not caught
 pass attempt that was not caught
 pass attempt that was caught for 10 yards
 pass attempt that was not caught
 pass attempt that was caught for 30 yards
 pass attempt that was intercepted
 pass attempt that was caught for 50 yards and a touchdown
 they would have 7 attempts, 3 completions, 1 interception, 90 yards, and 1 touchdown. This would give them a Passer Rating of 89.88.
Also, for example, if a quarterback threw 10 passes and only completed 1 for 10 yards, his Passer Rating would be 39.58
Solution
#include <stdio.h>
 #include <stdlib.h>
float passerRating(int completions, int attempts, int tds, int interceptions, int yards);
 float evaluate(float param);
 int getInt(char *prompt);
 int main(void)
 {
 int completions = 0, attempts = 0, tds = 0, interceptions = 0;
 int yards = 0;
 float rating = 0.0;
while( 1 )
 {
    attempts = getInt(\"attempts\");
    if( attempts == 0 )
        break;
    completions = getInt(\"completions\");
    tds = getInt(\"touchdowns\");
    interceptions = getInt(\"interceptions\");
    yards = getInt(\"yards\");
    rating = passerRating(completions, attempts, tds,
                interceptions, yards);
    printf(\"Rating is %.2f\ \", rating);
 }
 return 0;
 }
 int getInt(char *prompt)
 {
 char buffer[81] = {0};
 int value = 0;
 printf(\"\ Enter %s: \", prompt);
 fgets(buffer, 81, stdin);
 value = atoi(buffer);
 return value;
 }
float passerRating(int completions, int attempts, int tds, int interceptions, int yards)
 {
    float comp_rate = 0;
    float td_percent = 0;
    float intercept_rate = 0;
    float yards_attempts = 0;
    float passer_rating = 0;
   comp_rate = evaluate
        (((((float)completions / (float)attempts) * 100.0)
        -30.0) / 20.0);
td_percent = evaluate((((float)tds / (float)attempts) * 100.0) / 5.0);
   intercept_rate = evaluate((9.5 -
        (((float)interceptions / (float)attempts) * 100.0)) / 4.0);
   yards_attempts = evaluate((((float)yards / (float)attempts) - 3.0) / 4.0);
    printf(\"%f %f %f %f\", comp_rate, td_percent, intercept_rate, yards_attempts);
passer_rating = (comp_rate + td_percent + intercept_rate + yards_attempts) / 0.06;
return passer_rating;
 }
float evaluate(float param)
 {
    if(param > 2.375) return 2.375;
    else return 0;
 }



