import javax.swing.*; public class tester { public static void main(String[] args) { Stuff Data = new Stuff(); int myValue=0; while(myValue != -1) { String myInput = JOptionPane.showInputDialog(null, "Enter in number to store", "", JOptionPane.QUESTION_MESSAGE); myValue = Integer.parseInt(myInput); if (myValue != -1) { Data.addNew(myValue); } } JOptionPane.showMessageDialog(null,"The weighted average is"+ Data.weightedaverage(),"",JOptionPane.INFORMATION_MESSAGE); } }