hello guys i need a little bit of help. i have a java program that is suppose to be an assignment on learning for loops, this is my coding iv done (below) , it is suppose to accumulate 4 integers and add them together and if the value = below 34 it gives a certain message and vice versa if above 34 it gives another message. unfortunetly when i run the program it doesnt give me the correct accumulated value any help would be great.
import javax.swing.JOptionPane;
public class assessment4 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String disabilityclass;
int legality = 0;
for (int i = 1; i <=4; i++)
{
disabilityclass= JOptionPane.showInputDialog("What is the disability class of swimmer on leg " + i +"?");
legality= Integer.parseInt(disabilityclass);
legality = legality + i;
}
if (legality <= (34))
{
JOptionPane.showMessageDialog(null, "That is a legal team with " + legality + " point");
}
else
JOptionPane.showMessageDialog(null, "That is a illegal team with " + legality + " point");
}
}
-- Sat Oct 13, 2012 8:29 pm --
found the problem myself guys i simply needed to change
legality+= Integer.parseInt(disabilityclass);


