Its very simple you are not calculating applesToOrder
and orangesToOrder
again after user input so they are taking there previous values of 0
, just put these lines just above your last JOptionPane
statement and see the magic.
applesToOrder = applesTheyNeed - applesTheyHave;
orangesToOrder = orangesTheyNeed - orangesTheyHave;
1
solved subtraction not working in java program (missing something)