Question: Question In this program you are asked to compute the quarterback rating for an NFL quarterback. You will need to use methods for each of

Question

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.

Input and output should be done with Dialog and Message boxes. Your program should be well documented internally and externally.

What I have written

import java.util.Scanner; public class QuarterbackEfficiencyRating { public static void main(String[] args) { final double MIN_RATING = 0.0; // Min rating value final double MAX_RATING = 2.375; // Max rating value // Variables String name; //The name of the quarterback int attempts; // Number of attempts int completions; // Number of completions double yards; // Total Yards int touchdowns; // Touchdowns int interceptions; // Interceptions // Declare and instantiate Scanner object Scanner keyboard = new Scanner(System.in); // Prompt user to input the name quarterback System.out.print("Enter quarteback's name>"); name = keyboard.nextLine(); // Prompt user to input attempts System.out.print("Enter number of attempts>"); attempts = keyboard.nextInt(); // Prompt user to input completions System.out.print("Enter number of completions>"); completions = keyboard.nextInt(); //Prompt user to input total yards System.out.print("Enter total yards>"); yards = keyboard.nextInt(); //Prompt user to input touchdowns System.out.print("Enter number of touchtowns>"); touchdowns = keyboard.nextInt(); //Prompt user to input number of interceptions System.out.print("Enter number of interceptions>"); interceptions = keyboard.nextInt(); //Calculation variables double comp; //percentage of completions per attempt double yds; // average yards gained per attempt double tds; //percentage of touchdown passes per attempt double ints; //percentages of interceptions per attempt double QBER; //Quarterback Efficiency rating //Calculates COMP comp = 0.05 * (((100.0 * completions) / attempts) - 30); comp = Math.min(comp, MAX_RATING); // If comp > MAX_RATING then set comp to MAX_RATING comp = Math.max(comp, MIN_RATING); // if comp < MIN_RATING then set comp to MIN_RATING //Calculates yds yds = 0.25 * ((yards / attempts) - 3.0); yds = Math.min(yds, MAX_RATING); // If yds > MAX_RATING then set yds to MAX_RATING yds = Math.max(yds, MIN_RATING); // if yds < MIN_RATING then set yds to MIN_RATING //Calculates tds tds = 0.2 * (100.0 * touchdowns / attempts); tds = Math.min(tds, MAX_RATING); // If tds > MAX_RATING then set yds to MAX_RATING //Calculates ints ints = 2.375 - 0.25 * (100.0 * interceptions / attempts); ints = Math.min(ints, MAX_RATING); // If ints > MAX_RATING then set yds to MAX_RATING //Calculates QBER QBER = 100 * (comp + yds + tds + ints) / 6; //Display the QBER System.out.println("\" QBER Ananlysis for " + name" + "\" COMP = " + comp" + "\" YDS = " + yds" + "\" TDS = " + tds" + "\" INTS = " + ints" + "\\" QBER = " + QBER)"; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!