Hi I'm new to java and working on a program where I want to show the number of rentals for one person in one box and the total rentals in another box.
I am having trouble storing the variable or it is not recognizing that I want to keep adding to the count. I have something like:
//Class level variables
byte snowboards;
byte totalSum;
[...]
private void calculateJButtonActionPerformed(java.awt.event.ActionEvent evt)
{
snowboards = Byte.parseByte(snowboardsJSpinner.getValue().toString()); //reads value in the JSpinner object
String snowboard = dollars.format(snowboards*30); //formats the cost of x number of boards
snowboardsSummaryJTextField.setText(snowboard); //Displays cost of x number of boards selected
totalSum = 0;
totalSum += snowboards;
dailySnowboardsJTextField.setText(String.valueOf(totalSum));
}
My problem is that no matter how many times I click on my calculate button it reads and outputs the value in the JSpinner object but does not continually add it. If this code is not clear enough I can just add the whole project.