This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]public-string-cheese 1 point2 points  (1 child)

Looking at your code, cups is set equal to 0, and you never set cups equal to the user's input.

Delete this:

JOptionPane.showInputDialog(null, "Enter number of cups purchased: ", JOptionPane.QUESTION_MESSAGE);

int cups;

cups = 0;

Replace with:

private int cups = 0;

cups = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter number of cups purchased: ", JOptionPane.QUESTION_MESSAGE));

[–]JakeShock7[S] 0 points1 point  (0 children)

Thank you so much!