A programmer is creating an algorithm to display the cost of a ticket
based on the information in the table. The programmer uses the variable
"age" for the age of the ticket recipient. The Boolean variable
"includes Tour" is true when the ticket is for a guided tour and is false
when the ticket is for general admission. Which code segment correctly
displays the cost of a ticket? (Hint: it looks like you pay more if you are
older and you pay more if you have the tour. These are separate things
where either or both can raise the price)
Type of Ticket
General Admission Cost
(in dollars)
Guided Tour Cost
(in dollars)
8
Regular (ages 13 and up)
Child (ages 12 and below)
10
8
6
cost - 6
IF (age > 12)
{
cost 6
}
IF ((age > 12) OR includes Tour)
ELSE
{
{
cost cost + 2
cost cost + 2
IF (includes Tour)
{
cost cost + 2
}
}
DISPLAY (cost)
Option 4
cost - 6
IF (age > 12)
{
IF (includes Tour)
{
}
}
DISPLAY (cost)
O Option 3
In the following procedere, the
cost cost + 2
}
DISPLAY (cost)
Option 1
cost = 6
IF (age > 12)
{
cost = cost + 2
}
IF (includes Tour)
{