/chocolate-vending-machine

Chocolate Vending Machine

Primary LanguageJavaScript

Chocolate Vending Machine

image description

scripts

  • npm install to install dependencies
  • npm run start
  • npm run test

Question

  • You’ve been employed to build the software behind a brand new state-of-the-art vending machine to be rolled out to all public schools in Australia. The vending machine will dispense the latest vegan chocolate bars. Your task is to design a system that allows the user to enter coins in the following denominations (10c, 20c, 50c, $1, $2). It will then prompt the user to enter their choice of chocolate bar from the following selections; Caramel - $2.50, Hazelnut - $3.10 , Organic Raw - $2.00. The app must not allow the user to enter invalid currency and must ensure they’ve entered the correct amount of money prior to prompting for their selection. Writing unit tests is essential for this vending machine to make it into production and allow kids across the country to get awesome vegan snacks.

HINTS

●   What happens if the child enters too much money (two $2 coins)?
●   What happens if the child enters a 5c coin?
●   Don’t mix presentation logic with business logic
●   How does a child enter their choice of chocolate bar?
●   Browser or CLI - your choice