A regular traveler travels by car if the travel is at the weekend. However, if the travel is on a weekday the traveler takes a train unless the distance is greater than 200 miles. If the distance is greater than 200 miles the traveler books a flight.

Respuesta :

Answer:

See Explanation

Explanation:

The question is incomplete as the requirement is not stated;

However, since it's a computer question, I'll assume that you need to translate the given statement into a programming statement.

I'll answer using Python

First, the analysis:

The variables and values are:

1. Travel Period = Weekday or Weekend

2. Distance = Greater than 200 miles or Less than or equal to 200 miles

3. Transport Medium = Car or Train or Flight

The programming equivalent is

if travelperiod == "Weekend":

    transportmedium = "Car"

elif travelperiod == "Weekday":

    if distance > 200:

         transportmedium = "Car"

    else:

         transportmedium = "Train"

if distance > 200:

    transportmedium = "Flight"

Q&A Education