hi guys.
im trying to make my first java program and coming across problems.
my program simulates a coffee machine, where the final amount is displayed and the user selects what coin they insert... the next screen then shows the user how much money they have left... but everytime i have my variable (its a double) take away the money they have inserted (eg.... totalPrice (1.80) - 1), it comes up with an answer like .7999999994 instead of .8.
Anybody able to help?
I also tryed storing them in integers and having it in cents (eg. 180cents), but am not sure how to put the decimal point in when display to the user
Any help appreciated
im trying to make my first java program and coming across problems.
my program simulates a coffee machine, where the final amount is displayed and the user selects what coin they insert... the next screen then shows the user how much money they have left... but everytime i have my variable (its a double) take away the money they have inserted (eg.... totalPrice (1.80) - 1), it comes up with an answer like .7999999994 instead of .8.
Anybody able to help?
I also tryed storing them in integers and having it in cents (eg. 180cents), but am not sure how to put the decimal point in when display to the user
Any help appreciated
