cant figure out why summaryCounter wont increment??

if 	(source == calculateButton)
			int summaryCounter = 1;

		    double payment = Double.parseDouble(paymentTextField.getText());
            double rate = Double.parseDouble(rateTextField.getText());
            int years = (Integer)yearsComboBox.getSelectedItem();
            DecimalFormat currency = new DecimalFormat("  ##,##0.00");
            double futureValue;
            String s;
            int i;

            System.out.printf("\n  Investment Summary Option %d \n  Monthly Payment%,10.2f\n  Interest Rate    %8.1f\n  Years Invested   %8d\n\n", summaryCounter, payment, rate, years);
            for ( i = 1; i <= years; i++)
                futureValue = FinancialCalculations.calculateFutureValue(
                    payment, rate, i);
                s = "  Year " + i + ": " + currency.format(futureValue);

So where you do use it AFTER you have incremented it?

So far, you only print it once, when it's value has been initialised to 1.

Where are you using the counter to check whether it has been incremented or not. Post the entire code.

PS: He beat me to it.

Edited 6 Years Ago by verruckt24: n/a

This question has already been answered. Start a new discussion instead.