Skip to main content

Practice · 3 of 5

Shipping cost tiers

CHALLENGE
Difficulty: beginner+25 XP

Implement int shippingCost(int items, boolean prime): free (0) when prime AND at least 1 item; 5 when NOT prime and items >= 10; 8 when NOT prime and items >= 3; 12 otherwise. Order your checks so the tiers fall out naturally.

Back to lesson: Practice: Practice: Decisions