sprockets Super Mega Fox and Draggula Grey Rabbit with floppy ears Newton Dynamics test with PRJ Animation by Bobby! The New Year is Here! TV Commercial by Matt Campbell Greeting of Christmas Past by Gerry Mooney and Holmes Bryant!
sprockets
Recent Posts | Unread Content
Jump to content
Hash, Inc. - Animation:Master

Recommended Posts

  • Hash Fellow
Posted

The switch structure simplifies situations that might be done with an if and many else ifs but only consider an integer value to decide which else if to do.

 

sample project

Golf scores are integers, so are the "par" values for the holes. A player's score on a hole can be just a number but it is often described by how many strokes above or below par it was. Also, there are names for each specific above or below possibility

 

Write a program that prompts the user to input a par for a hole and the players number of strokes on that hole.

Output par for the hole, the player's strokes, how many strokes above or below par he was and the golf word for that accomplishment (for up to 3 above or below par).

 

Sample outputs:

Golf Jargon!


Enter your score for the hole: 5
Enter the par for the hole: 6

Your score was 5
Par for the hole was 6
You were 1 stroke(s) below par.
You played a birdie

 

Golf Jargon!


Enter your score for the hole: 7
Enter the par for the hole: 6

Your score was 7
Par for the hole was 6
You were 1 stroke(s) above par.
You played a bogey.

 

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...