how to code this? ( I have tried it but it's not working, my head hurts) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to code this? ( I have tried it but it's not working, my head hurts)

1Imagine you are creating a vending machine program. 2 The program should accept money in denominations of Twenty Peso (Php20), Ten Peso (Php10), Five Peso (Php5), and One Peso (Php1). 3 The program should keep asking the user for money until they have no money to enter anymore. 4 The vending machine dispenses 3 drinks: soda (costs Php50), juice (Php20), and water (Php18). 5 Once money is deposited, the program should ask which drink the user wants based on their choice (e.g., 1 for soda, 2 for juice, 3 for water). 6 Check if the deposited amount is greater than, less than, or equal to the drink price. The program informs the user if the amt is not enough; the program should return the difference as change if it is too much.

11th Mar 2024, 9:18 AM
L
L - avatar
3 Answers
+ 7
Please show us your code so we can help you. We are not a GPT chat and do not give ready-made answers.
11th Mar 2024, 10:09 AM
Knight
Knight - avatar
+ 2
I already did it, thank you everyone
11th Mar 2024, 1:45 PM
L
L - avatar
+ 1
Have you written any pseudocode? The steps are there, you just need to write them down first and tick the off as you code each part. https://www.sololearn.com/discuss/238489/?ref=app https://www.sololearn.com/discuss/316587/?ref=app
11th Mar 2024, 1:43 PM
Ausgrindtube
Ausgrindtube - avatar