1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Free_Kalibri [48]
3 years ago
5

Golf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to ho

le 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": number of strokes is two less than par
"Birdie": number of strokes is one less than par
"Par": number of strokes equals par
"Bogey": number of 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.

Ex: If the input is:
4
3
Computers and Technology
1 answer:
Kobotan [32]3 years ago
7 0

The program is an illustration of if conditional statement. The programming language is not stated; so, I will answer the question using Python.

The program in Python where comments are used to explain each line is as follows:

<em>#This initializes the scores</em>

scores = ["Eagle","Birdle","Par","Bogey"]

<em>#This gets input for par</em>

par = int(input())

<em>#This gets input for stroke</em>

stroke = int(input())

<em>#This checks if par and stroke are between 3 and 5 (inclusive)</em>

if (par >=3 and par <= 5) or (stroke >=3 and stroke <= 5):

<em>#This calculates the difference between par and stroke</em>

   diff = stroke - par  + 2

<em>#This prints the corresponding score</em>

   print(scores[diff])

<em>#If par or stroke is out of range of 3 and 5</em>

else:

<em>#This prints error</em>

   print("Error")

<em>#At the end of the program, the appropriate score is printed.</em>

See attachment for the program source code and the sample run

Read more about python programs at:

brainly.com/question/16917190

You might be interested in
If Number = 7, what will be displayed after code corresponding to the following pseudocode is run? (In the answer options, new l
kherson [118]

Answer:

5,10; 6,12; 7,14

Explanation:

We will demonstrate the iteration of the loop:

First iteration: Number = 7, Count = 5 at the beginning. We will check if Count <= Number? Since it is correct, prints 5,10. Increment the Count by 1.

Second iteration: Number = 7, Count = 6. We will check if Count <= Number? Since it is correct, prints 6,12. Increment the Count by 1.

Third iteration: Number = 7, Count = 7. We will check if Count <= Number? Since it is correct, prints 7,14. Increment the Count by 1.

Forth iteration: Number = 7, Count = 8. We will check if Count <= Number? Since it is not correct, the loop stops.

8 0
3 years ago
What shortcut keys do i use to print something on my keyboard ?
romanna [79]
CTRL+P. It's usually pressed when you want to print something.
5 0
3 years ago
Read 2 more answers
In the Word 2016 window, where is the Status bar located?
Ludmilka [50]

Answer:

The Word status bar is displayed at the bottom of your document window. Just click it. You can customize if needed, just right click on the status bar.

Explanation:

6 0
3 years ago
Microsoft word's spell checker
natka813 [3]
A, will also check word usage
7 0
3 years ago
Read 2 more answers
PLZ ANSWER WORTH 20 POINTS!! URGENT!
omeli [17]

Answer:

C. a registered Microsoft Account

8 0
3 years ago
Read 2 more answers
Other questions:
  • Typically, a programmer develops a programâs logic, writes the code, and ____ the program, receiving a list of syntax errors.
    6·1 answer
  • Can a computer will work more efficiently if you perform disk optimization
    9·1 answer
  • How can an individual find career data?
    13·1 answer
  • What is it called when you make a reference in the text of a document alerting the reader that you are using information from an
    10·1 answer
  • On five lane roadways, the center lane is designated for __________ and is used by vehicles traveling in both directions.A. Thro
    15·1 answer
  • Assume that another method has been defined that will compute and return the student's class rank (Freshman, Sophomore, etc). It
    8·1 answer
  • Julie is trying to decide weather or not to add a color scheme to her presentation and she asks you for your advice u should adv
    9·1 answer
  • Create a spreadsheet that lists the ten currencies you chose. For each currency, enter an amount and create a
    12·1 answer
  • What is the best method to avoid getting spyware on a machine
    6·1 answer
  • Which access object cannot be used to enter or edit data
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!