Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Activity 3

3.1 Design suitable algorithms for vehicle tariff calculation for rents and hires.
Ideally, 3 functions should be developed for this purpose as follows:

Function 1: Rent calculation.


Return the total rent_value when vehicle_no, rented_date, return_date, with_driver
Parameters are sent in. with_driver parameter is set to true or false depending whether the
Vehicle is rented with or without driver.

INPUT vehicle_no, rented_date, return_date, with_driver


IF with driver = 0 THEN
Type = “FALSE”
ELSE
Type = “TRUE”
END IF
Return total rent_value

Function 2: Day tour - hire calculation.


Calculate total hire_value when vehicle_no, package_type, start_time, end_time,
start_km_reading, end_km_reading parameters are sent in. Should return base_hire_charge,
Waiting_charge and extra_km_charge as output parameters.

INPUT vehicle_no, package_type, start_time, end_time,


start_km_reading, end_km_reading
CALCULATE total hire_value
Return base_hire_charge,
Waiting_charge and extra_km_charge
Function 3: Long tour - hire calculation.
Calculate total hire_value when vehicle_no, package_type, start_date, end_date,
start_km_reading, end_km_reading parameters are sent in. Should return base_hire_charge,
overnight_stay_charge and extra_km_charge as output parameters.

INPUT when vehicle_no, package_type, start_date, end_date,


start_km_reading, end_km_reading
CALCULATE total hire_value
Return base_hire_charge,
Waiting_charge and extra_km_charge

You might also like