0

I just try to do the Pset1 cash assignment and got a problem here(submit results).

Got a message that expected prompt for input, found none for 41 cents, 160 cents, returns integer number of cents, etc.. When tested manually, it works fine, but I don't know why the problem occurs only when run check50. What did I do wrong? please help...

here's my code: [code redacted]

1 Answer 1

2

First, the code isn't actually "prompting" the user for anything. Double quotes with nothing between them is not recognized as a prompt. It should ask something like "Please enter the amount of change: " That's why check50 is waiting for a prompt. That appears to be the bulk of the problem.

Programming hint: Think about efficiencies. When the code gets down to handling the remaining pennies, think about what you need to do. Do you need to call a function? Do you then need create a var to store the number of pennies? Or would it just be far more efficient to simply add the remaining value in change to coins, along with quarters, dimes and nickels?

It's about keeping code as simple as possible. ;-)

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • Thank you! I don't think I properly considered the user/testing program when getting their input. Your answer helped me a lot! Also, thanks for the feedback about the code:)
    – Claire
    Commented Jan 11, 2022 at 9:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .