COS1512 ASSIGNMENT 2
Due: Friday, 12 July 2024, 12:00 PM
YEAR MODULE 2024
PASS WITH DISTINCTIONS. FORTIS PASSUM
FOR FURTHER ASSISTANCE WITH ECONOMICS,
MANAGEMENT, ACCOUNTING, TAXATION EDUCATION@ LLB
MODULES.
CALL/WHATSAAP0816884518/0816884519
EMAIL:
, Question 1
def calcPostage(weight: float, zone: int) -> float:
# Constants for GlobalMail
COST_PER_KG_ZONE_1_TO_3 = 108
COST_PER_KG_ZONE_4_TO_6 = 130
if 1 <= zone <= 3:
return weight * COST_PER_KG_ZONE_1_TO_3
elif 4 <= zone <= 6:
return weight * COST_PER_KG_ZONE_4_TO_6
else:
raise ValueError("Invalid zone. Zone must be between 1 and 6.")
def calcPostage(weight: float, length: float, width: float, height: float) -> float:
# Constants for DHL
COST_PER_KG_DHL = 70
VOLUMETRIC_DIVISOR = 5000
volumetric_weight = (length * width * height) / VOLUMETRIC_DIVISOR
chargeable_weight = max(weight, volumetric_weight)
return chargeable_weight * COST_PER_KG_DHL
def main():
courier_choice = input("Enter 'g' for GlobalMail or 'd' for DHL: ").lower()
if courier_choice == 'g':
weight = float(input("Enter the weight of the parcel (kg): "))
zone = int(input("Enter the zone (1 to 6): "))
Due: Friday, 12 July 2024, 12:00 PM
YEAR MODULE 2024
PASS WITH DISTINCTIONS. FORTIS PASSUM
FOR FURTHER ASSISTANCE WITH ECONOMICS,
MANAGEMENT, ACCOUNTING, TAXATION EDUCATION@ LLB
MODULES.
CALL/WHATSAAP0816884518/0816884519
EMAIL:
, Question 1
def calcPostage(weight: float, zone: int) -> float:
# Constants for GlobalMail
COST_PER_KG_ZONE_1_TO_3 = 108
COST_PER_KG_ZONE_4_TO_6 = 130
if 1 <= zone <= 3:
return weight * COST_PER_KG_ZONE_1_TO_3
elif 4 <= zone <= 6:
return weight * COST_PER_KG_ZONE_4_TO_6
else:
raise ValueError("Invalid zone. Zone must be between 1 and 6.")
def calcPostage(weight: float, length: float, width: float, height: float) -> float:
# Constants for DHL
COST_PER_KG_DHL = 70
VOLUMETRIC_DIVISOR = 5000
volumetric_weight = (length * width * height) / VOLUMETRIC_DIVISOR
chargeable_weight = max(weight, volumetric_weight)
return chargeable_weight * COST_PER_KG_DHL
def main():
courier_choice = input("Enter 'g' for GlobalMail or 'd' for DHL: ").lower()
if courier_choice == 'g':
weight = float(input("Enter the weight of the parcel (kg): "))
zone = int(input("Enter the zone (1 to 6): "))