Read a JSON array of items {"name": string, "price": number, "qty": number} and print the cart total (price × qty summed), with 2 decimals.
Input: one JSON array of items. Output: total with toFixed(2).
Your program reads from stdin and prints to stdout.
Example 1
Input: [{"name":"pen","price":1.5,"qty":2}]
Output: 3.00
Hints
Read a JSON array of items {"name": string, "price": number, "qty": number} and print the cart total (price × qty summed), with 2 decimals.
Input: one JSON array of items. Output: total with toFixed(2).
Your program reads from stdin and prints to stdout.
Example 1
Input: [{"name":"pen","price":1.5,"qty":2}]
Output: 3.00
Hints