How many decisions does it take to hit a ping-pong ball?

Answer:

Very many. 10s of thousands; maybe more.

Robot Ping-Pong

The answer may surprise you. However, controlling a ping-pong paddle and coordinating it with a moving ball is very difficult. Scientists have written a computer program for a ping-pong playing robot. The program constantly makes very complicated decisions involving many thousands of IFs and other control structures. We won't write programs quite that complicated here.

Airfare Problem

An airline company has a three level price policy:

  1. Children under 12 fly free.
  2. Individuals from 12 to 23 fly at student rate, 70% of full fare.
  3. Everyone else flies at full fare.

Here is a start on the program that calculates airfare:

PRINT "Enter full fare"
INPUT FARE
PRINT "Enter age"
INPUT AGE
'
'Calculate discount rate based on age
  .  .  .  .

'Calculate and print the fare
PRINT "Your fare is:", FARE * RATE
END

QUESTION 2:

RATE will be one of three values: 0.0, 0.70, or 1.00 based on AGE. What type of control structure can you use to make this choice?