...

Exercise: Pizza Delivery Rules

You have been hired by an elite pizza shop to design a pizza delivery system with the following requirements:

  1. First asks for distance, and declines if it is over 10.
  2. If distance is okay, asks for the payment method
  3. Confirms delivery only for card or cash, and declines otherwise.

Your Task

Write code that implements the sequential pizza delivery process:

  • Ask for distance using the prompt method.
  • Use an if-else to check distance, and print "Sorry, we don't deliver that far."
  • If distance is acceptable, ask for payment method.
  • If the payment method is "card" or "cash", print "We can deliver your pizza!"
  • If the payment method is anything else, print "Sorry, we only accept card or cash."

Hint: Consider using an if statement inside of another if or else block, especially when checking the payment method.

Loading...

Output (Console)