Calculating taxi rate

After having declared and initialized the input data and the variable that stores the value of the price, we have to decide which conditions of the task have to be checked first.

The task specifies that the rates of two of the vehicles do not depend on whether it is day or night, but the rate of one of the transports (taxi) depends. This is why the first condition will be whether it is day or night, so that it is clear which rate the taxi will be using. To do that, we declare one more variable that stores the value of the taxi rate.

In order to calculate the taxi rate, we will use conditional statement of type if-else and through it, the variable for the price of the taxi will store its value.

results matching ""

    No results matching ""