The switch structure simplifies situations that might be done with an if and many else ifs and 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 output:
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
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.