Create a java class that calculates the various statistics of your favorite quarterback in NFL. If you don’t have one, you could use pick Matt Ryan of Atlanta Falcons from his 2015 season. Use either visit nfl.com or their team website for some of the data you would need to complete this assignment.
Implement the main method in the class and do the following in the main method
Java.
Values for the arrays are as follows:
Yards: 277,234,133,274,341,340,277,324,294,254,283,311,358,279,126,250
Throw attempts: 39,35,26,35,44,35,36,45,35,41,31,32,43,36,24,33
Completions: 26,24,14,23,34,24,25,29,22,21,20,24,27,25,13,24
Avg. Yards per attempt: 7.1,6.7,5.1,7.8,7.8,9.7,7.7,7.2,8.4,6.2,9.1,9.7,8.3,7.8,5.3,7.6
package Array;
// Defines a class NFLArray
public class NFLArray
{
// main method definition
public static void main(String[] args)
{
// Creates an array to store yards
int []yards = {277, 234, 133, 274, 341, 340, 277, 324, 294, 254, 283,
311, 358, 279, 126, 250};
// Creates an array to store throw attempts
int []throwAttempts = {39, 35, 26, 35, 44, 35, 36, 45, 35, 41, 31,
32, 43, 36, 24, 33};
// Creates an array to store completion
int [] completions = {26, 24, 14, 23, 34, 24, 25, 29, 22, 21, 20, 24,
27, 25, 13, 24};
// Create an array to store the average number of yards per attempt.
double avg[] = new double[yards.length];
// To store total yards
double total = 0;
// Counter to store number of yards was over 275.
int countOver = 0;
// To store highest yards
// Initially stores the starting yard as the highest yard
int highestYards = yards[0];
// Loops to calculate the total yards thrown in the entire season
// and to calculate the number of games where the number of
// yards was over 275.
// and calculates average
for(int i = 0; i < yards.length; i++)
{
// Calculates total
total += yards[i];
// Checks if current yards is greater than 275 then increase the counter by one
if(yards[i] > 275)
countOver++;
// Calculates average
avg[i] = yards[i] / (double)completions[i];
}// End of for loop
System.out.println("\n Number of games where the number of yards was over 275: "
+ countOver);
System.out.print("\n Average: ");
// Loops to print the average completion percentage for each of the games.
for(int i = 0; i < yards.length; i++)
System.out.printf("%.2f, ", avg[i]);
// Loops to get the highest yards thrown in a game during the season.
for(int i = 1; i < yards.length; i++)
// Checks if current yards is greater than earlier highest yard
if(yards[i] > highestYards)
// Update the highest yard by assigning current yard
highestYards = yards[i];
// Displays highest yard
System.out.print("\n Highest Yards thrown: " + highestYards);
}// End of main method
}// End of class
Sample Output:
Number of games where the number of yards was over 275: 10
Average: 10.65, 9.75, 9.50, 11.91, 10.03, 14.17, 11.08, 11.17,
13.36, 12.10, 14.15, 12.96, 13.26, 11.16, 9.69, 10.42,
Highest Yards thrown: 358
Create a java class that calculates the various statistics of your favorite quarterback in NFL. If...
Create a simple Java class for a Month object with the following requirements: This program will have a header block comment with your name, the course and section, as well as a brief description of what the class does. All methods will have comments concerning their purpose, their inputs, and their outputs One integer property: monthNumber (protected to only allow values 1-12). This is a numeric representation of the month (e.g. 1 represents January, 2 represents February,...
In JAVA, please. THANK YOU In this project you will create a generic linked list using Java Generics. Description: Create a generic class called GenLinkedList. GenLinkedList will use nodes that store a value of the generic type to store its contents. It should have the following methods. The methods should all operate on the object making the call (none are static). Perform checking of the parameters and throw exceptions where appropriate. The linked list should be singly-linked. It should not...
Design and implement a Java class (name it Summer Stats. java) that tracks statistics for summer job salaries for a group of people over several years. The only data field you need is a 2-Dimenssional array of values representing salaries. The rows the represents the people and the columns represent the years. The constructor method takes two integers representing the number of people and the number of years, then randomly generates the annual salaries and fills the array. Other class...
This is JAVA language Create a .java class called MoreArrayFun.java with only a main method. This program will use the ArrayManager class. The final version of the program is described below, but initially use it to test your ArrayManager class as you write it. Complete the ArrayManager class as specified below: The class will have exactly two instance variables: An array of integers A count of the number of elements currently in the array The class will have...
create java application with the following specifications: -create an employee class with the following attibutes: name and salary -add constuctor with arguments to initialize the attributes to valid values -write corresponding get and set methods for the attributes -add a method in Employee called verify() that returns true/false and validates that the salary falls in range1,000.00-99,999.99 Add a test application class to allow the user to enter employee information and display output: -using input(either scanner or jOption), allow user to...
JAVA PROGRAMMING PLEASE This lab has three parts: Create an ArrayList class. Create a LinkedList class. Print out the results after testing each of the methods in both of the classes and solving a simple problem with them. Task 1 – ArrayList Class Create an ArrayList class. This is a class that uses an internal array, but manipulates the array so that the array can be dynamically changed. This class should contain a default and overloaded constructor, where the default...
Use JAVA language. public class DynamicArray2 { private String[] data; // the backing array private int virtualArrayLength; // the number of elements in the dynamic array // Throws an IndexOutOfBoundsException if i is not a valid index // for adding to the dynamic array, otherwise inserts s at index i. // Elements can be added from index 0 to this.size(). public void add(int i, String s) { // If there is no room for s in data, create a new...
[IN JAVA] Copy the following code into your main.cpp and complete it public class Main { public static void main(String [] args) { int [] array1 = {5, 8, 34, 7, 2, 46, 53, 12, 24, 65}; int numElements = 10; System.out.println("Part 1"); // Part 1 // Enter the statement to print the numbers in index 5 and index 8 // put a space in between the two numbers and a new line at the end // Enter the statement...
Java Program Create a class to store an array of with enough space to store 10 integer values. Using the principle of recursion, implement the following: *getSize : returns the size of the array. *get (i): returns the i-th element of the array. If the element does not exist, it throws a "NoSuchElementException” which is a subclass of Java class RunTimeException. *add (val): inserts value as the last element of the array. If necessary, double the size of the current...
Design and implement a Java class (name it SummerStats.java) that tracks statistics for summer job salaries for a group of people over several years. The only data field you need is a 2-Dimenssional array of values representing salaries. The rows the represents the people and the columns represent the years. The constructor method takes two integers representing the number of people and the number of years, then randomly generates the annual salaries and fills the array. Other class methods include...