Question
The NFL rates its passers for statistical purposes against a fixed performance standard based on statistical achievements of all qualified pro passers since 1960. The
The NFL rates its passers for statistical purposes against a fixed performance standard based on statistical achievements of all qualified pro passers since 1960. The current system replaced one that rated passers in relation to their position in a total group based on various criteria.
The current system, which was adopted in 1973, removes inequities that existed in the former method and, at the same time, provides a means of comparing passing performances from one season to the next.
It is important to remember that the system is used to rate passers, not quarterbacks. Statistics do not reflect leadership, play-calling, and other intangible factors that go into making a successful professional quarterback.
Four categories are used as a basis for compiling a rating: 1. Percentage of completions per attempt 2. Average yards gained per attempt 3. Percentage of touchdown passes per attempt 4. Percentage of interceptions per attempt
The average standard, is 1.000. The bottom is .000. To earn a 2.000 rating, a passer must perform at exceptional levels, i.e., 70 percent in completions, 10 percent in touchdowns, 1.5 percent in interceptions, and 11 yards average gain per pass attempt. The maximum a passer can receive in any category is 2.375 (see examples at the end of the program).
In order to make the rating more understandable, the point rating is then converted into a scale of 100. In rare cases, where statistical performance has been superior, it is possible for a passer to surpass a 100 rating.
For example, take Steve Young's record-setting season in 1994 when he completed 324 of 461 passes for 3,969 yards, 35 touchdowns, and 10 interceptions.
The four calculations would be:
Percentage of Completions 324 of 461 is 70.28 percent. Subtract 30 from the completion percentage (40.28) and multiply the result by 0.05. The result is a point rating of 2.014. Note: If the result is less than zero (Comp. Pct. less than 30.0), award zero points. If the results are greater than 2.375 (Comp. Pct. greater than 77.5), award 2.375.
Average Yards Gained Per Attempt 3,969 yards divided by 461 attempts is 8.61. Subtract three yards from yards-per-attempt (5.61) and multiply the result by 0.25. The result is 1.403. Note: If the result is less than zero (yards per attempt less than 3.0), award zero points. If the result is greater than 2.375 (yards per attempt greater than 12.5), award 2.375 points.
Percentage of Touchdown Passes 35 touchdowns in 461 attempts is 7.59 percent. Multiply the touchdown percentage by 0.2. The result is 1.518. Note: If the result is greater than 2.375 (touchdown percentage greater than 11.875), award 2.375.
Percentage of Interceptions 10 interceptions in 461 attempts is 2.17 percent. Multiply the interception percentage by 0.25 (0.542) and subtract the number from 2.375. The result is 1.833. Note: If the result is less than zero (interception percentage greater than 9.5), award zero points.
The sum of the four steps is (2.014 + 1.403 + 1.518 + 1.833) 6.768. The sum is then divided by six (1.128) and multiplied by 100. In this case, the result is 112.8. This same formula can be used to determine a passer rating for any player who attempts at least one pass.
In this program you are asked to compute the quarterback rating for an NFL quarterback. You will need to use methods for each of the Processing items and the output of your information. You do not have to have a method for the inputting of your data. Have your main call the methods and control the program.
Input:
Name String Quarterbacks Name
Completed Integer The number of completed passes
Attempts Integer The number of pass attempts
Yards Integer The number of receiving yards
Touchdowns Integer The number of passing TDs
Interceptions Integer The number of passing Interceptions
Processing:
Rating Real Total of the following four
Percent Completion Real See above
Ave Yards Gained Real
Percent of TDs Real
Percent of Ints Real
Output:
All data the user inputs, calculated variables from Processing and the Quarterbacks rating. You may
retrieve and display the data any way you would like.
This program should be well written and well documented both internally and externally.
Trivia: To gain a 2.375 in completion percentage, a passer would have to complete 77.5 percent of his passes. The NFL record is 70.55 by Ken Anderson (Cincinnati, 1982). To earn a 2.375 in percentage of touchdowns, a passer would have to achieve a percentage of 11.9. The record is 13.9 by Sid Luckman (Chicago, 1943). To gain 2.375 in percentage of interceptions, a passer would have to go the entire season without an interception. The 2.375 figure in average yards is 12.50, compared with the NFL record of 11.17 by Tommy O'Connell (Cleveland, 1957).
//THIS IS MY PROGRAM
// I NEED OUTPUT IN GRIDLAYOUT/GUI
// OBJECT ORIENTED PROGRAMMING
import java.util.*;
import javax.swing.*;
import java.text.DecimalFormat;
public class Ch7_Assign1
{
public static void main(String[] args)
{
/*****************************************************************/
//------------------Input the Data---------------------------
/*****************************************
*
* Using separate, subsequent dialog boxes,
* the user will be prompted to enter data
* regarding the quarterback.
*
******************************************/
String name =
JOptionPane.showInputDialog
("Please enter the quarterback's name: ");
String completedTemp =
JOptionPane.showInputDialog
("Please enter the number of completed passes: ");
int completed = Integer.parseInt(completedTemp);
String attemptsTemp =
JOptionPane.showInputDialog
("Please enter the number of attempted passes: ");
int attempted = Integer.parseInt(attemptsTemp);
String yardsTemp =
JOptionPane.showInputDialog
("Please enter the number of receiving yards: ");
int yard = Integer.parseInt(yardsTemp);
String touchdownsTemp =
JOptionPane.showInputDialog
("Please enter the number of passing TDs: ");
int touchdown = Integer.parseInt(touchdownsTemp);
String interceptionsTemp =
JOptionPane.showInputDialog
("Please enter the number of intercepted passes: ");
int interception = Integer.parseInt(interceptionsTemp);
//----------------Call Methods--------------------------------
/********************************************
*
* Here, I call my methods and store the
* corresponding statistic as a new
* double variable, for later use.
*
* Note that in the last call, I use the
* former results to calculate the QB rating.
*
*********************************************/
double compResult = calcCompletions(completed, attempted);
double ygaResult = calcYGA(yard, attempted);
double tdResult = calcTDResult(touchdown, attempted);
double interResult = calcInter(interception, attempted);
double rating = qbRating(compResult, ygaResult,
tdResult, interResult);
//----------------Display the output--------------------------
/********************************************
*
* Using the data computed from my methods
* below and called/stored above, I use
* a dialog box to display all of the
* data at once.
* I decided to use the DecimalFormat class
* to display the output to three decimal
* places, since it is much cleaner than printf
*
*********************************************/
DecimalFormat threeDec = new DecimalFormat("0.000");
String output = name + "'s quarterback rating is: " +
threeDec.format(rating) + "." +
" " + "This is based upon the data you inputted:" +
" " + "Completed Passes: " + completed + "." +
" " + "Attempted Passes: " + attempted + "." +
" " + "Receiving Yards: " + yard + "." +
" " + "Touchdowns: " + touchdown + "." +
" " + "Interceptions: " + interception + "." + " " +
" " + "Percentage of Completions: "
+ threeDec.format(compResult) + "." +
" " + "Average Yards Gained Per Attempt: "
+ threeDec.format(ygaResult) + "." +
" " + "Percentage of Touchdowns: "
+ threeDec.format(tdResult) + "." +
" " + "Percentage of Interceptions: "
+ threeDec.format(interResult) + ".";
JOptionPane.showMessageDialog(null, output,
"Quarterback Rating", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
//---------Create Methods---------------------------------
/********************************************
*
* Here, I have created methods that receive
* their input data from the dialog boxes
* above and return double values to be
* stored in the variables above, when the
* methods are called.
*
* The method for the QB rating requires
* several 'if' statements nested within
* the method, for proper calculation
* of the rating. By using non-void methods,
* I was able to more easily manipulate the
* data in terms of calculating the QB rating,
* as well as the output.
*
*********************************************/
public static double calcCompletions(int comp, int attempt)
{
double comps = comp;
double attempts = attempt;
double compPerc = (comps/attempts)*100;
return compPerc;
}
public static double calcYGA(int yard, int attempt)
{
double yards = yard;
double attempts = attempt;
double YGA = (yards/attempts);
return YGA;
}
public static double calcTDResult(int td, int attempt)
{
double tds = td;
double attempts = attempt;
double tdPerc = (tds/attempts)*100;
return tdPerc;
}
public static double calcInter(int inter, int attempt)
{
double inters = inter;
double attempts = attempt;
double interPerc = (inters/attempts)*100;
return interPerc;
}
public static double qbRating(double comp, double yga,
double td, double inter)
{
double compRating = (comp - 30.0)*.05;
if (compRating < 0.0)
compRating = 0.0;
if (compRating > 2.375)
compRating = 2.375;
double ygaRating = (yga - 3.0)*0.25;
if (ygaRating < 0.0)
ygaRating = 0.0;
if (ygaRating > 2.375)
ygaRating = 2.375;
double tdRating = (td*0.2);
if (tdRating > 2.375)
tdRating = 2.375;
double intRating = 2.375 - (inter*0.25);
if (intRating < 0.0)
intRating = 0.0;
double rating = (compRating + ygaRating +
tdRating + intRating)/6 * 100;
return rating;
}
/*****************************************************************/
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started