Procházet zdrojové kódy

Done but still might need to check over one more time

Nicholas Maidanos před 6 roky
rodič
revize
c5d9f3295b
9 změnil soubory, kde provedl 175 přidání a 9 odebrání
  1. binární
      Game/Main.class
  2. 6
    0
      Game/Main.ctxt
  3. 56
    0
      Game/Main.java
  4. 36
    0
      Game/Main.java#backup
  5. 12
    0
      Game/README.TXT
  6. 0
    0
      Game/README.md
  7. 27
    0
      Game/package.bluej
  8. 0
    9
      Main.java
  9. 38
    0
      package.bluej

binární
Game/Main.class Zobrazit soubor


+ 6
- 0
Game/Main.ctxt Zobrazit soubor

@@ -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=
5
+comment1.target=void\ main()
6
+numComments=2

+ 56
- 0
Game/Main.java Zobrazit soubor

@@ -0,0 +1,56 @@
1
+package Game;
2
+import java.util.Scanner;
3
+import java.lang.Math;
4
+import java.util.concurrent.ThreadLocalRandom;
5
+
6
+/**
7
+ * Created by iyasuwatts on 10/17/17.
8
+ */
9
+public class Main {
10
+
11
+    public static void main(){
12
+        
13
+        int min = 0;
14
+        int max = 100;
15
+        
16
+        
17
+        int randomNum = ThreadLocalRandom.current().nextInt(min, max + 1);
18
+        
19
+        System.out.print("Please enter a number Between 1 and 100\n");
20
+            
21
+        int prevNumber = -1;
22
+        int counter = 0;
23
+        
24
+        boolean looping = true;    
25
+        while(looping) {
26
+            System.out.print("Enter a Number: \n");
27
+            Scanner input = new Scanner(System.in);
28
+            int num = input.nextInt();
29
+            //Scanner scanner = new Scanner(System.in);
30
+            //int num = Integer.parseInt(scanner.nextLine());
31
+            
32
+            if(num > -1 && num < 101 ){
33
+                if(num == randomNum){
34
+                    System.out.print("You guessed is Right!\n");
35
+                    looping = false;
36
+                    if(prevNumber != num){ counter++;};
37
+                    System.out.print(counter + " Tries");
38
+                } else if(num > randomNum) {
39
+                    System.out.print("Number is to Large\n");
40
+                    if(prevNumber != num){ counter++;};
41
+                    prevNumber = num;
42
+                } else if(num < randomNum) {
43
+                    System.out.print("Number is to Small\n");
44
+                    if(prevNumber != num){ counter++;};
45
+                    prevNumber = num;
46
+                }            
47
+            } else {
48
+             System.out.print("Please enter a number between 1 - 100 \n");
49
+             if(prevNumber != num){ counter++;};
50
+            }
51
+
52
+            
53
+        }
54
+
55
+    }
56
+}

+ 36
- 0
Game/Main.java#backup Zobrazit soubor

@@ -0,0 +1,36 @@
1
+package Game;
2
+
3
+import java.util.Scanner;
4
+import java.lang.Math;
5
+import java.util.concurrent.ThreadLocalRandom;
6
+
7
+/**
8
+ * Created by iyasuwatts on 10/17/17.
9
+ */
10
+public class Main {
11
+
12
+    public static void main(){
13
+        
14
+        int min = 0;
15
+        int max = 100;
16
+        
17
+        boolean looping = true;
18
+        int randomNum = ThreadLocalRandom.current().nextInt(min, max + 1);
19
+        
20
+        while(looping) {
21
+            System.out.print("Enter a Number: \n");
22
+            Scanner scanner = new Scanner(System.in);
23
+            int num = Integer.parseInt(scanner.nextLine());
24
+            
25
+            if(num == randomNum){
26
+                System.out.print("You guessed is Right\n");
27
+                looping = false;
28
+            } else if(num > randomNum) {
29
+                System.out.print("Number is to Large\n");
30
+            } else if(num < randomNum) {
31
+                System.out.print("Number is to Small\n");
32
+            }
33
+        }
34
+
35
+    }
36
+}

+ 12
- 0
Game/README.TXT Zobrazit soubor

@@ -0,0 +1,12 @@
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:

README.md → Game/README.md Zobrazit soubor


+ 27
- 0
Game/package.bluej Zobrazit soubor

@@ -0,0 +1,27 @@
1
+#BlueJ package file
2
+objectbench.height=101
3
+objectbench.width=461
4
+package.divider.horizontal=0.6
5
+package.divider.vertical=0.8007380073800738
6
+package.editor.height=427
7
+package.editor.width=674
8
+package.editor.x=263
9
+package.editor.y=160
10
+package.frame.height=600
11
+package.frame.width=800
12
+package.numDependencies=0
13
+package.numTargets=1
14
+package.showExtends=true
15
+package.showUses=true
16
+readme.height=58
17
+readme.name=@README
18
+readme.width=47
19
+readme.x=10
20
+readme.y=10
21
+target1.height=50
22
+target1.name=Main
23
+target1.showInterface=false
24
+target1.type=ClassTarget
25
+target1.width=80
26
+target1.x=180
27
+target1.y=10

+ 0
- 9
Main.java Zobrazit soubor

@@ -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
-}

+ 38
- 0
package.bluej Zobrazit soubor

@@ -0,0 +1,38 @@
1
+#BlueJ package file
2
+editor.fx.0.height=684
3
+editor.fx.0.width=800
4
+editor.fx.0.x=240
5
+editor.fx.0.y=23
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=0
13
+package.editor.y=23
14
+package.frame.height=600
15
+package.frame.width=800
16
+package.numDependencies=0
17
+package.numTargets=2
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=62
27
+target1.name=Game
28
+target1.type=PackageTarget
29
+target1.width=80
30
+target1.x=90
31
+target1.y=10
32
+target2.height=50
33
+target2.name=Main
34
+target2.showInterface=false
35
+target2.type=ClassTarget
36
+target2.width=80
37
+target2.x=180
38
+target2.y=10