It is given that,
For the first ride, the cost is $16.
For two rides, the cost is $22.
That is,
$16+$6=$22.
Similarly,
For three rides, the cost is,
$22+$6=$28
It can be verified by checking for four rides.
For four rides, the given cost is $34.
That is, $28+$6=$34.
Therefore, for three rides, the cost is $28.