In C++
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 10PE
Related questions
Question
In C++
![3.20 LAB: Golf scores
Golf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to hole and is
called par (i.e. 3, 4, or 5). Each score's name is based on the actual strokes taken compared to par:
●
●
●
"Eagle": strokes is two less than par
"Birdie": strokes is one less than par
4 3
"Par": strokes equals par
"Bogey": strokes is one more than par
Given two integers that represent par and the number of strokes used, write a program that prints the appropriate score name. Print "Error"
if par is not 3, 4, or 5. Print "None" if the par is valid, but the strokes do not fall in the range of Eagle/Birdie/Par/Bogey.
Ex: If the input is:
the output is:
Birdie
417118.2791720.qx3zqy7](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fda17b6d9-f7ff-4a56-9763-458bee0c35b1%2F70a02193-7816-4668-a5c7-ea14cfc7f455%2F8i1vp6_processed.png&w=3840&q=75)
Transcribed Image Text:3.20 LAB: Golf scores
Golf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to hole and is
called par (i.e. 3, 4, or 5). Each score's name is based on the actual strokes taken compared to par:
●
●
●
"Eagle": strokes is two less than par
"Birdie": strokes is one less than par
4 3
"Par": strokes equals par
"Bogey": strokes is one more than par
Given two integers that represent par and the number of strokes used, write a program that prints the appropriate score name. Print "Error"
if par is not 3, 4, or 5. Print "None" if the par is valid, but the strokes do not fall in the range of Eagle/Birdie/Par/Bogey.
Ex: If the input is:
the output is:
Birdie
417118.2791720.qx3zqy7
![LAB
ACTIVITY
3.20.1: LAB: Golf scores
1 #include <iostream>
2 using namespace std;
3
4 int main() {
5
6
7
8
9
10
11}
int par;
int strokes;
/* Type your code here */
return 0;
Develop mode
Submit mode
Run program
Enter program input (optional)
If your code requires input values, provide them here.
Program output displayed here
main.cpp
Input (from above)
Run your program as often as you'd like, before submitting for grading. Below, type any needed
input values in the first box, then click Run program and observe the program's output in the
second box.
main.cpp
(Your program)
0/22
Load default template...
Output (shown below)
li](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fda17b6d9-f7ff-4a56-9763-458bee0c35b1%2F70a02193-7816-4668-a5c7-ea14cfc7f455%2Flz0ygy_processed.png&w=3840&q=75)
Transcribed Image Text:LAB
ACTIVITY
3.20.1: LAB: Golf scores
1 #include <iostream>
2 using namespace std;
3
4 int main() {
5
6
7
8
9
10
11}
int par;
int strokes;
/* Type your code here */
return 0;
Develop mode
Submit mode
Run program
Enter program input (optional)
If your code requires input values, provide them here.
Program output displayed here
main.cpp
Input (from above)
Run your program as often as you'd like, before submitting for grading. Below, type any needed
input values in the first box, then click Run program and observe the program's output in the
second box.
main.cpp
(Your program)
0/22
Load default template...
Output (shown below)
li
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning