how can I give 0.5 in change. I dont think I can.
let change;
change = cash - price;
console.log(change);
I am getting this output:
0.5
0.5
0.5
96.74
0.5
0.5
0.5
0.5
try to think about what you would do if you had a real cash register in front of you.
And you need to give back 0.5 of a dollar (which is 50 cents).
You would check you register to see what denominations of coins you have.
For eg. if you have 0 pennies, 0 nickels, 0 dimes and 0 quarters, then you cannot give the customer back any change because you don’t have small enough denominations.
But if you have 50 pennies, you can give 50 pennies back.
Or if you have 2 quarters, then you can give 2 quarters back.
Or if you have 1 quarter and 2 dimes and 1 nickel, then that works also.
- what does [“PENNY”, 1.01] mean?
- what does [“NICKEL”, 2.05] mean?
- what does [“QUARTER”, 4.25], [“ONE”, 90], [“FIVE”, 55], [“TEN”, 20], mean?
I just dont understand these.
these amounts represent the total amount in $ of money in the given denomination.
So for:
[“PENNY”, 1.01]
It means there are 101 pennies in the drawer
[“NICKEL”, 2.05]
means there are 41 nickels (41 x 5 = 205 cents)
[“QUARTER”, 4.25], [“ONE”, 90], [“FIVE”, 55], [“TEN”, 20],
This one means the drawer has 17 quarters, 90 dollar bills, 11 five dollar bills and 2 ten dollar bills.
This task is just too advanced for beginners. I won’t be able to complete it.
I was really looking forward to completing the javascript Data Structures but its just too much and too complicated. We are still beginners not advanced coders.
I give up
Thank you for trying to help
I am sorry to hear that.
If there is anything else I can help you understand, please do not hesitate to ask.
This task is not for beginners. It is for people who have completed the entire freeCodeCamp basic JavaScript course and have intermediate skills. I recommend reviewing that course without copying or looking up answers if you cannot complete this project.
I havent copied anyones code
I am talking about the previous challenges. I’m not saying that you did copy necessarily, but usually when someone gets to the projects and finds them impossible, it is because they didn’t build problem solving skills during the curriculum. The most common cause of that is that they looked up solutions to the previous challenges before they finished writing their own.
In any case, practicing problem solving without looking up answers in a good idea if you find this totally impossible.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.