CMPS 134 Fall 2025
Prog. Assg. #3: NFL Passer Rating
Due: 11:59pm, Tuesday, September 30

Background

Quarterbacks in the NFL (National Football League) are rated according to a formula that involves five passing statistics:

Welcome to the NFL Passer Rating application!

Enter # of passes attempted:> 475
Enter # of completed passes:> 320
Enter # of passing yards:> 3523
Enter # of TD passes:> 15
Enter # of passes intercepted:> 9

NFL Passer Rating: 91.76
Goodbye.

For this assignment, you are to complete the Java application program PasserRatingNFL. The program prompts the user to enter five inputs, as listed above, and uses the responses to compute a passer rating. A sample user/program dialog is shown to the right.

The Formula

Using these, we compute

However, if any among A, B, C, or D exceeds 2.375, it is set to 2.375, and if it is less than zero, it is set to zero.

To adjust a variable, say x, to ensure that its value is between 0.0 and 2.375, you could use the following assignment statement, which makes use of the Math class's min() and max() methods:

x = Math.max(0, Math.min(x, 2.375))

Finally, the passer rating is obtained by multiplying the constant 100/6 by the sum of the "factors" listed above:

passer rating   =   (100.0 / 6.0) · (A + B + C + D)

Your Task

The Java class provided to you includes four functional methods that are stubbed, meaning that their bodies are essentially empty and left to you to complete. (Because the Java compiler insists that every functional method includes a return statement, such statements are present in the stubs, but the values they return are just "dummies".)

One of the four methods is intended to compute the passer rating. The remaining three are intended to compute three of the four "factors" listed above. The method intended to compute the fourth factor is missing entirely and is left for you to supply.

Each of these methods receive, via its formal parameters, exactly the inputs that it needs.

Finally, within the body of the main method a statement is needed that prints the passer rating, preferably with exactly two digits following the decimal point.


Program Submission

Submit your completed Java source code file (PasserRatingNFL.java) to the appropriate Brightspace dropbox. Note that you can submit multiple times; each submission takes precedence over earlier ones. As usual, the Java class's "header" comments should include ones that identify you as an author, list any collaborators, and mention any program defects that you are aware of.