Bookshop Change
JavaScript
10 pts
Bookshop Change
Abel has money = 200 Nakfa. A book costs bookPrice = 120 and a pen penPrice = 25. Create:
total= book plus penchange= money minus totalcanBuy= whethermoneyis greater than or equal tototal(use>=)
Print the first two lines by joining strings with + (for example "Total: " + total + " Nakfa"):
Total: 145 Nakfa Change: 55 Nakfa Can buy: true
Checklist
- Calculate
totalandchange. - Store the comparison in
canBuy. - Build the first two lines with string
+. - Print the three lines.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
