#29 TG finished

Open
tennesseegibbs wants to merge 1 commits from tennesseegibbs/ZCW-TooLargeTooSmall-BlueJ:master into master
10 changed files with 124 additions and 0 deletions
  1. BIN
      .DS_Store
  2. BIN
      GuessGame.class
  3. 6
    0
      GuessGame.ctxt
  4. 61
    0
      GuessGame.java
  5. BIN
      Main.class
  6. 6
    0
      Main.ctxt
  7. 0
    0
      Main.java
  8. 12
    0
      README.TXT
  9. 0
    0
      README.md
  10. 39
    0
      package.bluej

BIN
.DS_Store View File


BIN
GuessGame.class View File


+ 6
- 0
GuessGame.ctxt View File

1
+#BlueJ class context
2
+comment0.target=GuessGame
3
+comment1.params=args
4
+comment1.target=void\ main(java.lang.String[])
5
+comment1.text=\n\ Constructor\ for\ objects\ of\ class\ GuessGame\n
6
+numComments=2

+ 61
- 0
GuessGame.java View File

1
+
2
+/**
3
+ * Write a description of class GuessGame here.
4
+ *
5
+ * @author (your name)
6
+ * @version (a version number or a date)
7
+ */
8
+import java.util.Random;
9
+import java.util.Scanner;
10
+public class GuessGame
11
+{
12
+    // instance variables - replace the example below with your own
13
+    private int x;
14
+
15
+    /**
16
+     * Constructor for objects of class GuessGame
17
+     */
18
+    public static void main(String[] args){
19
+        System.out.println("Hello and welcome to my number guessing game.");
20
+        System.out.println("Pick a number 1 through 10: ");
21
+
22
+        Scanner input = new Scanner(System.in); 
23
+        int guess;
24
+        int counter = 0;
25
+        int prevGuess = -1;
26
+
27
+        int rand = (int) (Math.random()*10)+1;
28
+        boolean notCorrect = true;
29
+        while(notCorrect){ 
30
+            guess = input.nextInt();
31
+            
32
+            if(guess != prevGuess){
33
+                counter++;
34
+            }
35
+            prevGuess = guess;
36
+            if(guess > rand){
37
+                System.out.println("Your guess is too high");
38
+            } else if(guess < rand){
39
+                System.out.println("Your guess is too low"); 
40
+            }else {
41
+                notCorrect = false;
42
+                System.out.println("You got it! " + counter + " guesses");
43
+            }
44
+
45
+        }
46
+        /*if (guess == number){ 
47
+        System.out.println("You got it!");
48
+        }
49
+        else if (guess < number){
50
+        System.out.println("Your guess is too low");
51
+
52
+        }
53
+        else if (guess > number){
54
+        System.out.println("Your guess is too high");
55
+
56
+        }*/
57
+
58
+    }
59
+}
60
+
61
+    

BIN
Main.class View File


+ 6
- 0
Main.ctxt View File

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

+ 0
- 0
Main.java View File


+ 12
- 0
README.TXT View File

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:

+ 0
- 0
README.md View File


+ 39
- 0
package.bluej View File

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=461
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=64
13
+package.editor.y=119
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=50
27
+target1.name=GuessGame
28
+target1.showInterface=false
29
+target1.type=ClassTarget
30
+target1.width=100
31
+target1.x=70
32
+target1.y=10
33
+target2.height=50
34
+target2.name=Main
35
+target2.showInterface=false
36
+target2.type=ClassTarget
37
+target2.width=80
38
+target2.x=180
39
+target2.y=10