#37 Lab Completed

Отворено
chu1ta26 жели да споји 1 комит(е) из chu1ta26/ZCW-TooLargeTooSmall-BlueJ:master у master
7 измењених фајлова са 88 додато и 1 уклоњено
  1. BIN
      .DS_Store
  2. BIN
      Main.class
  3. 5
    0
      Main.ctxt
  4. 39
    1
      Main.java
  5. BIN
      TooLargeTooSmall/.DS_Store
  6. 12
    0
      TooLargeTooSmall/README.TXT
  7. 32
    0
      package.bluej


+ 5
- 0
Main.ctxt Прегледај датотеку

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

+ 39
- 1
Main.java Прегледај датотеку

1
 /**
1
 /**
2
  * Created by iyasuwatts on 10/17/17.
2
  * Created by iyasuwatts on 10/17/17.
3
  */
3
  */
4
+import java.util.Scanner;
5
+import java.util.Random;
6
+
4
 public class Main {
7
 public class Main {
5
 
8
 
6
     public static void main(String[] args){
9
     public static void main(String[] args){
7
-        
10
+        Scanner input = new Scanner(System.in);
11
+        int randNumb;
12
+        int guess;
13
+        int numbAtempts=0;
14
+        Random genRand = new Random();
15
+        randNumb= genRand.nextInt(100) +1;
16
+        int lastInput;
17
+
18
+        System.out.println ("I'm thinking off a number between 1 to 100?:");
19
+
20
+         guess=input.nextInt();
21
+         lastInput=guess;
22
+
23
+        while (guess !=randNumb ){
24
+            if (guess> randNumb){
25
+                System.out.println("Your number is too BIG ");
26
+                guess=input.nextInt();
27
+                 
28
+               
29
+                numbAtempts+=1;
30
+            
31
+            } else {
32
+                System.out.println("Your number is too SMALL");
33
+                guess=input.nextInt();
34
+              numbAtempts+=1;
35
+            
36
+               
37
+            }
38
+             
39
+
40
+        } 
41
+
42
+        System.out.println(randNumb + " is the right number and it only took you" +" "+ (numbAtempts + 1) + " tries");
8
     }
43
     }
44
+
45
+        
9
 }
46
 }
47
+

BIN
TooLargeTooSmall/.DS_Store Прегледај датотеку


+ 12
- 0
TooLargeTooSmall/README.TXT Прегледај датотеку

1
+------------------------------------------------------------------------
2
+This is the project README file. Here, you should describe your project.
3
+Tell the reader (someone who does not know anything about this project)
4
+all he/she needs to know. The comments should usually include at least:
5
+------------------------------------------------------------------------
6
+
7
+PROJECT TITLE:
8
+PURPOSE OF PROJECT:
9
+VERSION or DATE:
10
+HOW TO START THIS PROJECT:
11
+AUTHORS:
12
+USER INSTRUCTIONS:

+ 32
- 0
package.bluej Прегледај датотеку

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
6
+objectbench.height=101
7
+objectbench.width=776
8
+package.divider.horizontal=0.6
9
+package.divider.vertical=0.8007380073800738
10
+package.editor.height=427
11
+package.editor.width=674
12
+package.editor.x=88
13
+package.editor.y=119
14
+package.frame.height=600
15
+package.frame.width=800
16
+package.numDependencies=0
17
+package.numTargets=1
18
+package.showExtends=true
19
+package.showUses=true
20
+project.charset=UTF-8
21
+readme.height=58
22
+readme.name=@README
23
+readme.width=47
24
+readme.x=10
25
+readme.y=10
26
+target1.height=50
27
+target1.name=Main
28
+target1.showInterface=false
29
+target1.type=ClassTarget
30
+target1.width=80
31
+target1.x=70
32
+target1.y=10