I'm not 100% sure, but I have a theory. Are you pressing ENTER to finish entering the price? It seems like nextDouble
isn't consuming an ENTER-press, so the following call to nextLine
sees it, and assumes you entered nothing for the category. Try using nextLine
to get the price and convert it to a double separately... if that works, then my theory is correct.
Gribouillis commented: good link +13
savedlema commented: thanks. please check my reply. +2
MareoRaft commented: if %d is for integers, what is %i for? +3
brian71289 commented: Great Job! +0
zachattack05 commented: That's a good point +5
Chuckleluck commented: Did more than just gave me the code to fix the error, he explained the causes very clearly and overall did a great job replying. +2
PoovenM commented: Clean, simple answer. Thank you :) +6