diff --git a/Lab01/.classpath b/Lab01/.classpath new file mode 100644 index 0000000..9af0373 --- /dev/null +++ b/Lab01/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Lab01/.project b/Lab01/.project new file mode 100644 index 0000000..4299593 --- /dev/null +++ b/Lab01/.project @@ -0,0 +1,17 @@ + + + Lab01 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Lab01/src/lab01/Lab01.java b/Lab01/src/lab01/Lab01.java new file mode 100644 index 0000000..6856148 --- /dev/null +++ b/Lab01/src/lab01/Lab01.java @@ -0,0 +1,20 @@ +package lab01; + +import javax.swing.JOptionPane; + +public class Lab01 { + + public static void main(String[] args) { + int x = Integer.parseInt(JOptionPane.showInputDialog("Please enter the number of elements: ")); + + int sum = 0; + for(int i = 0; i < x; i++) { + int next = Integer.parseInt(JOptionPane.showInputDialog("Please enter a number: ")); + sum += next; + } + + float avg = sum/(float)x; + JOptionPane.showMessageDialog(null, "The average is: " + String.valueOf(avg)); + } + +}