# Its C programming Answer the question The following is a part of a program that calculates an NFL Qu

Its C programming

The following is a part of a program that calculates an NFL Quarterback&#39;s Passer Rating.

#include
#include

### Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

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 %.2fn”, rating);
}
return 0;
}

int getInt(char *prompt)
{
char buffer[81] = {0};
int value = 0;

printf(“nEnter %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&#39;s entries will adhere to the following rules:

completions
tds
interceptions
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&#39;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