No matter what I enter in for my amounts, it always tells me that the total is 13. Here is my code:
String input = "";
int month = 1;
int year = 0;
int total = 0;
double average = 0.00;
int inches = 0;
int rainfall = 0;
for (int lcv = 0; lcv <= year; lcv++)
{ // Begin for loop for years
// Prompt for number of years
input = JOptionPane.showInputDialog("How many years of rainfall? ");
for (int m = 1; month <= 12; month++)
{ // Begin for loop for months
// Prompt for inches for the month
input = JOptionPane.showInputDialog("How many inches of rainfall for the month? ");
// Convert input into rainfall
rainfall = Integer.parseInt(input);
// Add total rainfall to total
total += rainfall;
} // End for loop for months
} // End for loop for years
What am I missing here?