Change array initializer location

This commit is contained in:
Siwat Sirichai 2020-10-29 21:46:04 +07:00
parent d252f6ef50
commit cb435fae59
4 changed files with 3 additions and 4 deletions

View File

@ -32,7 +32,6 @@ public class GolfScore {
public static void run(String scoreFile) { public static void run(String scoreFile) {
// 1. get golfer's names from golf-score-1.csv // 1. get golfer's names from golf-score-1.csv
String[] golfers = getGolfers(scoreFile); String[] golfers = getGolfers(scoreFile);
// 2. get golfer's scores from golf-score-1.csv // 2. get golfer's scores from golf-score-1.csv
int[][] golfScoreList = getScores(scoreFile); int[][] golfScoreList = getScores(scoreFile);
@ -149,7 +148,7 @@ public class GolfScore {
*/ */
public static int[] calculateHandicap(int[][] scores, int[] par) { public static int[] calculateHandicap(int[][] scores, int[] par) {
// ENTER CODE HERE // 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 i = 0; i < scores.length; i++) //Loop through each row
for (int j = 0; j < scores[i].length; j++) //Loop through each hole 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 hc[i] += calculateHoleHandicap(par[j], scores[i][j]); //no. golfer = row = i+1; no. hole = column = j+1

View File

@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse #Generated by Maven Integration for Eclipse
#Thu Oct 29 15:42:14 ICT 2020 #Thu Oct 29 16:39:34 ICT 2020
m2e.projectLocation=C\:\\Users\\siwat\\GitHub\\ise-comprog-after-midterm\\screwdriver-3.5.6 m2e.projectLocation=C\:\\Users\\siwat\\GitHub\\ise-comprog-after-midterm\\screwdriver-3.5.6
m2e.projectName=screwdriver-3.5.6 m2e.projectName=screwdriver-3.5.6
groupId=it.ramecera.ict groupId=it.ramecera.ict

View File

@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse #Generated by Maven Integration for Eclipse
#Thu Oct 29 15:42:21 ICT 2020 #Thu Oct 29 16:39:34 ICT 2020
m2e.projectLocation=C\:\\Users\\siwat\\GitHub\\ise-comprog-after-midterm\\waxds-copper m2e.projectLocation=C\:\\Users\\siwat\\GitHub\\ise-comprog-after-midterm\\waxds-copper
m2e.projectName=waxds-copper m2e.projectName=waxds-copper
groupId=it.ramecera.ict groupId=it.ramecera.ict