Create and Call Functions
Introduction
Age category
Extra costs per day
let extraCosts = 0;
if (Age >= 18 && Age < 31) {
extraCosts = ROUND(NumberOfDays * ExtraCostPerDay18_30);
}
if (Age >= 31 && Age < 51) {
extraCosts = ROUND(NumberOfDays * ExtraCostPerDay31_50);
}
if (Age >= 51) {
extraCosts = ROUND(NumberOfDays * ExtraCostPerDay51AndUp);
}Create and call functions
Task: Add extra input and constants
Input
Name
Type
Constants
Name
Constant type
Value
Task: Create a function to calculate extra costs
Task: Add an Age rule
Task: Call the AgeSurcharge function within your ruleset
AgeSurcharge function within your ruleset