🛒 Supermarket Trolley · Mission 6 of 7

🧮 The Price Machine

The till is tired of multiplying! Build it a price machine: give it a price and how many, and it gives back what they cost.

Your mission

  1. Make a Function called lineTotal, given price and qty. Its Return gives back price * qty.
  2. Call it for 3 apples at Rs 20: apples = lineTotal(20, 3). Then for 2 juices at Rs 30: juices = lineTotal(30, 2).
  3. Make total = apples + juices, and say "Total: Rs <total>".

Getting the mission ready…