I needed to solve a question which asked me to allow ten grades to be entered, and find the average [which means finding the total]
below is what I have so far. An though it compiles without error and runs showing the JOption Pane, it only does so once, when It should appear ten times, what am I doing wrong =[?
could someone guide me please, I'd appreciate it, thank you.
import javax.swing.*;
public class AverageTest{
public static void main(String[]args){
double total=0;
for (int i=1; i<=10; i++);
{
String grade= JOptionPane.showInputDialog("Enter Grade");
double g= Double.parseDouble(grade);
total+=g;
}
double avg;
avg= total/10;
JOptionPane.showMessageDialog(null,"The Average is"+ avg);
}//End class
}//End Main
below is what I have so far. An though it compiles without error and runs showing the JOption Pane, it only does so once, when It should appear ten times, what am I doing wrong =[?
could someone guide me please, I'd appreciate it, thank you.
import javax.swing.*;
public class AverageTest{
public static void main(String[]args){
double total=0;
for (int i=1; i<=10; i++);
{
String grade= JOptionPane.showInputDialog("Enter Grade");
double g= Double.parseDouble(grade);
total+=g;
}
double avg;
avg= total/10;
JOptionPane.showMessageDialog(null,"The Average is"+ avg);
}//End class
}//End Main