if anyone can please help to convert this if else statements in to parallel array to find out calculate the discounts.
is a data structure for representing arrays of records. It keeps a separate, homogeneous array for each field of the record, each having the same number of elements. Then, objects located at the same index in each array are implicitly the fields of a single record. Pointers from one object to another are replaced by array indices. This contrasts with the normal approach of storing all fields of each record together in memory.
For example, one might declare an array of 100 names, each a string, and 100 ages, each an integer, associating each name with the age that has the same index.
'discount calculations of total cost with GST
if TotGST >= 5000 AND TotGST <= 9999 then
discount = (TotGST * 0.05)
else
if TotGST >= 10000 AND TotGST <= 49999 then
discount = (TotGST * 0.08)
else
if TotGST >= 50000 then
else
discount = (TotGST * 0.1)
end if
end if
end if
First of all, set up the parallel arrays. Then loop through the arrays in a loop to find the matching range. If it matches, apply the discount.
See sample code below
Output