Looks like you need to use another for loop to make sure you’re tallying each score:
for(int i = 0; i < h; i++) {
score_result = pArray[i] - hArray[i];
System.out.print(score_result);
}
If you just want the final score it would look something like this:
int final_score = 0;
for(int i = 0; i < h; i++) {
score_result = pArray[i] - hArray[i];
final_score += score_result;
}
System.out.println(final_score);
5
solved Golf Score Tally Program Java – Stuck