Skill set for this LAB:
Problem 1 (100 points): Work commute requires driving on highway and crossing the bridge. The highway has 3 exits, and the cost is defined by table 1 below. The highway could be used in both directions. The bridge cost is defined by table 2.
Write a function highway(in_exit, out_exit) that has two parameters, in_exit - exit number the car enters the highway, and out_exit - the exit number the car exits the highway. The function returns the cost of the highway drive. Use Table 1.
Write a program that reads in_exit, out_exit, car type and ez pass indicator and calculates total cost of work commute. In case and at least one of the inputs is not valid, the program outputs the error message.
X | 1 | 2 | 3 |
1 | X | $2.5 | $3.5 |
2 | $2.5 | X | $1.5 |
3 | $3.5 | $1.5 | X |
CAR TYPE: | COST |
1 : | $5 |
2 : | $6 |
CAR TYPE: | COST |
1 : | $4.5 |
2 : | $4.5 |