Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 2: Every hole on a golf course is rated: a par-3, a par-4, a par-5, or a par-6. A golfer's score/stroke's taken on
Problem 2: Every hole on a golf course is rated: a par-3, a par-4, a par-5, or a par-6. A golfer's score/stroke's taken on a hole in relation to the hole's par is often described in the following terms: par is when the strokes taken is equal to par for the hole. A birdie is a score of 1-under par on a hole. An eagle is a score of 2-under par on a hole. A double eagle is 3-under par on a hole. . A bogey is 1-over par on a hole. A double bogey is 2-over par on a hole. A triple bogey is 3-over par. Write a program that takes an ordered pair of the form (par, strokes) and scores the hole by displaying one of the terms above as appropriate. If the value received for par is not 3, 4, 5, or 6, display an error message that contains the words "invalid par" and do not score the hole. If the number of strokes received is less than 1, display an error message that contains the words "Invalid strokes" and do not score the hole. If the strokes are further under par than a double eagle, display a message that includes the word "unbelievable". If the strokes are further over par than a triple bogey, display a message that includes "wah wah". Use a switch statement in a meaningful way to implement the logic of your program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started