Skip to content

Instantly share code, notes, and snippets.

@mattswann
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save mattswann/41ac056f783c5de4cff4 to your computer and use it in GitHub Desktop.

Select an option

Save mattswann/41ac056f783c5de4cff4 to your computer and use it in GitHub Desktop.

###Mini Golf Scores

####Exercise Bob, Jimbo and Fish love mini golf. But, like all good golfers they enjoy the 19th hole the most. Every time they hand in their score cards none of the scores are ever totalled. Write a function called totalScores in JS that calculates their scores and 'console.logs' the total for the club house.

#####Bob

  • Hole 1 = 3
  • Hole 2 = 2
  • Hole 3 = 6
  • Hole 4 = 11
  • Hole 5 = 9
  • Hole 6 = 2
  • Hole 7 = 6
  • Hole 8 = 9
  • Hole 9 = 10

#####Jimbo

  • Hole 1 = 5
  • Hole 2 = 12
  • Hole 3 = 9
  • Hole 4 = 22
  • Hole 5 = 13
  • Hole 6 = 7
  • Hole 7 = 16
  • Hole 8 = 10
  • Hole 9 = 11

#####Fish

  • Hole 1 = 2
  • Hole 2 = 2
  • Hole 3 = 4
  • Hole 4 = 5
  • Hole 5 = 4
  • Hole 6 = 3
  • Hole 7 = 6
  • Hole 8 = 4
  • Hole 9 = 1

####Extension Now work out each golfers round compared to the course par.

#####Par

  • Hole 1 = 3
  • Hole 2 = 4
  • Hole 3 = 5
  • Hole 4 = 5
  • Hole 5 = 3
  • Hole 6 = 3
  • Hole 7 = 4
  • Hole 8 = 3
  • Hole 9 = 5

####Ninja Extension Fish loves a punt. Having placed a $1 bet on each stroke over par that Bob and Jimbo played per hole calculate his winnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment