19.9k views
0 votes
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.

1 Answer

4 votes

Answer:

See Explanation

Step-by-step 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"

User Krupal Panchal
by
5.7k points