product: the product name that the user selected. change: an array of coins (can be empty, must be sorted in descending order). Examples vendingMachine (products, 200, 7) {product: "Crackers", change: [ 50, 20, 10 ] vendingMachine (products, 500, 0) → "Enter a valid product number" IN Java Script Programming language

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question
The coins used for the change are the following: [500, 200, 100, 50, 20, 10]
The return value is an object with 2 properties:
product: the product name that the user selected.
change: an array of coins (can be empty, must be sorted in descending order).
Examples
vendingMachine (products, 200, 7) → { product: "Crackers", change: [ 50, 20, 10 ] }
vendingMachine (products, 500, 0) → "Enter a valid product number"
IN Java Script Programming language
Transcribed Image Text:The coins used for the change are the following: [500, 200, 100, 50, 20, 10] The return value is an object with 2 properties: product: the product name that the user selected. change: an array of coins (can be empty, must be sorted in descending order). Examples vendingMachine (products, 200, 7) → { product: "Crackers", change: [ 50, 20, 10 ] } vendingMachine (products, 500, 0) → "Enter a valid product number" IN Java Script Programming language
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,