#using replit for comp sci A for next year

1 messages · Page 1 of 1 (latest)

full compass
#

Lab 7
Miniature Golf
Objective:
To learn about one-dimensional arrays of fixed length
To practice I-P-O (input-process-output) formatting.
Assignment:
Write a program that:
Contains 3 functions other than the main (main is not required in javascript)
Uses a one-dimensional array
That asks the user for their full name and the number of strokes taken on each hole of an 18-hole miniature golf course
Calculates the final score and how many holes-in-one the player had (holes where score is 1)
Prints out a scorecard

Remember when you pass your array it is always passed as a reference parameter, even if you are not changing its contents. Just be careful that you are not accidentally making any modifications. You can prevent it from being modified using const, but that’s not necessary in this class.
Sample Output
The output for your scorecard should look just like what you see below, with proper spacing and alignment. I have skipped many lines of input in the ...
Enter name of player: Tiger E. Woods
Enter the number of strokes for each hole.
hole[1]: 3
hole[2]: 1

hole[18]: 5

Tiger E. Woods, here is your scorecard:

Hole : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Score: 3 1 6 4 2 3 3 1 2 4 5 3 2 2 2 3 4 5

Your total is 55.
You scored 2 holes-in-one.
this is the prompt and what it should output i need help but it needs to look simple

ebon hinge
#

That a nice assignment but what is your question?

#

Have you tried anything? Can you share your code?

full compass
#

no i dont have code

#

i dunno how to start off the code

full compass
#

function getScores() {
var scores = [];
for (var hole = 1; hole <= 18; hole++) {
var score = Number(prompt(Enter the number of strokes for hole ${hole}:));
scores.push([score]);
}
return scores;
} actually how does the ${hole} work

#

var name = prompt("Enter name of player:");
const holes = ["hole[1]","hole[2]","hole[3]","hole[4]","hole[5]","hole[6]","hole[7]","hole[8]","hole[9]","hole[10]","hole[11]","hole[12]","hole[13]","hole[14]","hole[15]","hole[16]","hole[17]","hole[18]"] what i got so far i still need help

full compass
#

is there a way to close this