Browse Source

Finished SumOf Input

Nathan Hall 6 years ago
parent
commit
0d385a6b19
5 changed files with 37 additions and 17 deletions
  1. 0
    9
      Main.java
  2. BIN
      SumOfInput.class
  3. 5
    0
      SumOfInput.ctxt
  4. 24
    0
      SumOfInput.java
  5. 8
    8
      package.bluej

+ 0
- 9
Main.java View File

@@ -1,9 +0,0 @@
1
-/**
2
- * Created by iyasuwatts on 10/17/17.
3
- */
4
-public class Main {
5
-
6
-    public static void main(String[] args){
7
-
8
-    }
9
-}

BIN
SumOfInput.class View File


+ 5
- 0
SumOfInput.ctxt View File

@@ -0,0 +1,5 @@
1
+#BlueJ class context
2
+comment0.target=SumOfInput
3
+comment1.params=args
4
+comment1.target=void\ main(java.lang.String[])
5
+numComments=2

+ 24
- 0
SumOfInput.java View File

@@ -0,0 +1,24 @@
1
+/**
2
+ * Created by iyasuwatts on 10/17/17.
3
+ */
4
+
5
+import java.util.Scanner;
6
+
7
+public class SumOfInput {
8
+
9
+    public static void main(String[] args){
10
+        Scanner scan = new Scanner(System.in);
11
+        System.out.println("Input a number:");
12
+        int number = scan.nextInt();
13
+        int total = 0;
14
+        
15
+        System.out.println("Your number is " + number + "!");
16
+        
17
+        for(int i = 1; i <= number; i++){
18
+            total += i;
19
+        }
20
+        
21
+        System.out.println("The sum is: " + total);
22
+
23
+    }
24
+}

+ 8
- 8
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=722
3
+editor.fx.0.width=800
4
+editor.fx.0.x=367
5
+editor.fx.0.y=28
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=100
13
+package.editor.y=100
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0
@@ -24,9 +24,9 @@ readme.width=47
24 24
 readme.x=10
25 25
 readme.y=10
26 26
 target1.height=50
27
-target1.name=Main
27
+target1.name=SumOfInput
28 28
 target1.showInterface=false
29 29
 target1.type=ClassTarget
30
-target1.width=80
30
+target1.width=100
31 31
 target1.x=70
32 32
 target1.y=10