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.
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:
Finally, the passer rating is obtained by multiplying the constant 100/6 by the sum of the "factors" listed above:
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.