Create the "Parcel Delivery Calculator" app.
The user enters the parcel weight in kg and the delivery distance in km, and also marks whether express delivery is needed. After clicking the button, the final delivery cost needs to be calculated.
calculateWeightCost(). Inside the function itself
get the weight and store it in the variable weightKg,
then return weightKg * 3
calculateDistanceCost() โ takes no arguments. Inside the function itself
get the distance and store it in the variable distanceKm,
then return distanceKm * 2
calculateUrgentSurcharge(amount) โ takes the amount. Inside the
function itself, create a flag variable isUrgent (true/false, set manually).
If isUrgent === true โ returns amount * 1.25,
otherwise โ returns amount unchanged.
calculateTotalCost() โ all the other functions are called inside it.
The final result needs to be displayed on the screen.
Given:
Calculation (step by step):
Total cost: 50 $