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
icon
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
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
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
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning