#30 SumOfInput Lab

Open
jasamuels wants to merge 1 commits from jasamuels/ZCW-SumOfInput-BlueJ:master into master
4 changed files with 28 additions and 7 deletions
  1. BIN
      Main.class
  2. 6
    0
      Main.ctxt
  3. 16
    1
      Main.java
  4. 6
    6
      package.bluej

BIN
Main.class View File


+ 6
- 0
Main.ctxt View File

@@ -0,0 +1,6 @@
1
+#BlueJ class context
2
+comment0.target=Main
3
+comment0.text=\n\ Created\ by\ iyasuwatts\ on\ 10/17/17.\n
4
+comment1.params=args
5
+comment1.target=void\ main(java.lang.String[])
6
+numComments=2

+ 16
- 1
Main.java View File

@@ -1,9 +1,24 @@
1
+;import java.util.*;
1 2
 /**
2 3
  * Created by iyasuwatts on 10/17/17.
3 4
  */
4 5
 public class Main {
5 6
 
6 7
     public static void main(String[] args){
8
+    
9
+    Scanner in = new Scanner(System.in);
10
+    System.out.print("Enter a Number");
11
+    
12
+    int n = in.nextInt(); // user input #
13
+    int s = 0; // # to store sum until n is reached
14
+    // System.out.println(s); test to make sure n is getting captured
7 15
 
16
+    for (int i = 1; i <= n; i++) {
17
+        s = i + s;
8 18
     }
9
-}
19
+
20
+   System.out.println(s);
21
+
22
+};
23
+
24
+};

+ 6
- 6
package.bluej View File

@@ -1,16 +1,16 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=0
3
-editor.fx.0.width=0
4
-editor.fx.0.x=0
5
-editor.fx.0.y=0
2
+editor.fx.0.height=709
3
+editor.fx.0.width=800
4
+editor.fx.0.x=480
5
+editor.fx.0.y=23
6 6
 objectbench.height=164
7 7
 objectbench.width=776
8 8
 package.divider.horizontal=0.6
9 9
 package.divider.vertical=0.6845018450184502
10 10
 package.editor.height=364
11 11
 package.editor.width=674
12
-package.editor.x=-816
13
-package.editor.y=445
12
+package.editor.x=96
13
+package.editor.y=23
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0