# I need help in understanding this c++ program...

+1 vote
1. A taxicab company calculates charges using a fixed \$3.20 hire charge, a \$2.05-per-kilometer charge for the distance covered, and an additional \$0.95-per-minute charge based on the duration of the journey, in minutes. If the journey starts between 2300 and 0600 hours, a 15% surcharge is applied.

Write a program that asks the user to input the duration of the journey (rounded up to the nearest minute), the distance traveled (in kilometers), and the journey start time (as a 24-hour single int value). The program should then output the fare that should be charged.

answered Nov 23, 2018 by (1,100 points)

You need to implement the following logic:

INPUT:

duration = HHMM (HH - hours, MM - minutes)

distance = kilometers

CALCULATION ALGORITHM PSEUDOCODE:

hire = 3.20 + 2.05 x distance + 0.95 x minutes;

if ((journeyStarts >= 2300 AND journeyStarts <=2400) OR (journeyStarts >= 0000 AND journeyStarts <= 0600)) then

hire = hire + 0.15 x hire;