0 of 8 problems solved • 0%
Use in a course

Exercise prompt

Delivery Quote

A delivery quote depends on the order subtotal and a free-delivery threshold.

Your task

  1. Declare calculateSubtotal(price, quantity) and return their product.
  2. Declare calculateDelivery(subtotal) and return 0 when the subtotal is at least 30; otherwise return 5.
  3. Use both functions to create subtotal, delivery, and total.

For the supplied values, display exactly:

Subtotal: 36 Delivery: 0 Total: 36

Hint

The delivery rule depends on the subtotal, so calculate that first.