Skip to main content

Algorithm (Without loop)

An algorithm for solving the stated problem, on a single occasion only, could be as follows:

Begin

Display 'Enter miles at start of hire: '
Get StartMiles

Display 'Enter miles at end of hire: '
Get StopMiles

Calc TotalMiles as StopMiles - StartMiles
Calc StandardCharge as TotalMiles * 0.20
Calc Surcharge as (TotalMiles DIV 1000) * 25
Calc TotalCharge as StandardCharge + Surcharge

Display 'The total cost of the hire is ' , TotalCharge

End

Next: Algorithm (With Loop)