i have to work out the question below. i have to use this same format too but having problems figuring out where I'm going wrong. thanks in advance.
/* Write a program which averages a sequence of percentage * marks input by the user. The number of values input will vary from run to run. This will be indicated by an invalid mark being input. */ import javax.swing.JOptionPane; class Week6_2 { public static void main(String[]args) { int counter = 0; int mark = 0; while (mark != -1) { String s = JOptionPane.showInputDialog("enter mark or type -1 to exit"); mark = Integer.parseInt(s); counter = counter+1; int sum = mark+counter; int average = sum/counter; } JOptionPane.showMessageDialog(null,"average = "+ average); } }