Cash Register project. Can I get an additional hint?

Hello there guys.

So I´ve been a couple of days stuck on this project. Usually I wait a lot more time of stuck-ness to make a post but in this case I haven´t progressed nothing. Not a single line of code yet I am sure of that makes sense. Today i erased again the code I had right now again from blank

I´ve been trying to do stuff with the currency s. The thing is I have absolutely no idea about how can I make an “intelligence” that knows which currency to use to return change depending on how much the customer gives you

I know “moneyToReturn = cash - price”

But how make instructions to know if to return quarters or pennies or whatever i dont know.

Anyway I´m not asking to tell me how but rather before I actually have an insight on how to do the change return, I need to know how organize/amount the money in the currencies. How to do this? Who knows, ive tried to divide each one by 100, multiply, etc but more or less blindly why im doing it. Mm doesn´t make sense to me yet. How much days is expected to spend on this challenge anyway?

So, you have an object that contains how much money of each denomination is in the cash register

Let’s say you have (using euros denominations because I don’t have familiarities in dollars)
0 in 500€
0 in 200€
100€ in 100€
100€ in 50€
100€ in 20€
30€ in 10€
0 in 5€
4€ in 2€
1€ in 1€
1€ in 0.5€
0.6€ in 0.2€
0.5€ in 0.1€
0.25€ in 0.05€
0.10€ in 0.02€
0.15€ in 0.01€

You need to give back 7.27€
How much of each denomination do you need to give back?
You could consider one denomination at a time and give one coin of that denomination at a time till you can’t give of that kind anymore and then the same with the lower one, etc till you have given all or have finished the possible denominations
So, from the highest to lowest, the first denomination that you can use is 2€, so one 2€, an other 2€ - finished, next one, one 1€ - finished, next one, 0.5€, and again 0.5€ - finished, next one: 0.2€, 0.2€, 0.2€ -finished coins again, next one (current total 6.6€) - 0.1€, 0.1€, 0.1€, 0.1€, 0.1€ - (7.1€), finished coins again, next one - 0.05€, 0.05€, 0.05€ (7.25€) now the coins aren’t finished but a coin of this kind is bigger than the remaining rest to give, so next denomination, 0.02€ - finished! Rest given, the register is still open

1 Like

Omg, I think you couldn´t explained better! Thank you so much friend, I´ll get to code inmediately now

How much did you understand of completing previous challenge roman letter something like than. this challenge is really close to that challenge
watch this video . it is a too difficult task to explain that project.
but this video will make you understand.

Not much. I had big trouble doing the Roman letters converter. I ended up doing a 400 line code script to make it work lmao, (but I´m satisfied with it since it was a scalable as any other more normal solutions…)

Summary

This text will be hidden