Change array initializer location
This commit is contained in:
parent
d252f6ef50
commit
cb435fae59
4 changed files with 3 additions and 4 deletions
|
@ -32,7 +32,6 @@ public class GolfScore {
|
|||
public static void run(String scoreFile) {
|
||||
// 1. get golfer's names from golf-score-1.csv
|
||||
String[] golfers = getGolfers(scoreFile);
|
||||
|
||||
// 2. get golfer's scores from golf-score-1.csv
|
||||
int[][] golfScoreList = getScores(scoreFile);
|
||||
|
||||
|
@ -149,7 +148,7 @@ public class GolfScore {
|
|||
*/
|
||||
public static int[] calculateHandicap(int[][] scores, int[] par) {
|
||||
// ENTER CODE HERE
|
||||
int hc[] = new int[scores.length]; //create a handicap array of nGolfers elements
|
||||
int[] hc = new int[scores.length]; //create a handicap array of nGolfers elements
|
||||
for (int i = 0; i < scores.length; i++) //Loop through each row
|
||||
for (int j = 0; j < scores[i].length; j++) //Loop through each hole
|
||||
hc[i] += calculateHoleHandicap(par[j], scores[i][j]); //no. golfer = row = i+1; no. hole = column = j+1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue