Java HW 7

Abdulwahed
NewTextDocument.txt

/* * First Last * MIS 4310 Fall 2017 * Programming Assignment 7 * */ public class spurs_template { public static void main(String[] args) { /* * Declares and intializes a 2D array that contains total * {FGM, FGA, FG%} for each Spurs player in 2017-2018. * * Definitions: * Field Goals Made per game (FGM) * Field Goals Attempted per game (FGA) * Field Goals Percentage per game (FG%) * * DO NOT ALTER THE DATA. * Source: http://www.espn.com/nba/team/stats/_/name/sa */ double stats[][] = { {8.4, 16.8, 0.497}, {4.5, 9.6, 0.473}, {4.1, 8.4, 0.484}, {4, 9.8, 0.409}, {3.6, 6.9, 0.515}, {3.2, 8.7, 0.364}, {3, 7.3, 0.41}, {2.9, 7.1, 0.41}, {2.4, 5.3, 0.455}, {1.4, 2.7, 0.5}, {1.4, 3.8, 0.382}, {0.9, 2.2, 0.424}, {1, 1, 1}, {0.3, 1.7, 0.2}, {0, 0.5, 0} }; // end array of stats /* * Declare and initialize a String array that holds the player names * using the names listed on the instructions. Don't change the order! */ // Your code here /* * Using a nested for loop, print the player names with stats. * Example output: * LaMarcus Aldridge: 8.4 16.8 0.497 * Rudy Gay: 4.5 9.6 0.473 * .... and so on. * Make sure the stats are on one line per player. */ // Your code here /* * Using a *single* for loop, determine * 1) Which player that is NOT Aldridge * had the highest FGM and FGA * 2) The value of the highest FGM and FGA * * Hint: * What is the column index for FGM? * What is the column index for FGA? * Use the variables declared. */ double maxFGM = 0; double maxFGA = 0; int maxFGMindex = 0; int maxFGAindex = 0; // Your code here System.out.println("------------------"); /* * Finally, print the results. * Print the max FGM and the corresponding player. * Print the max FGA and the corresponding player. * * Check the instructions for the output style. */ // Your code here } }