#34 Steffon Williams, TooLargeTooSmall

otevřený
Stwillia94 chce sloučit 1 revizí z větve Stwillia94/ZCW-TooLargeTooSmall-BlueJ:master do větve master

binární
.DS_Store Zobrazit soubor


binární
GuessingGame/Main.class Zobrazit soubor


+ 6
- 0
GuessingGame/Main.ctxt Zobrazit soubor

1
+#BlueJ class context
2
+comment0.target=Main
3
+comment0.text=\n\ Write\ a\ description\ of\ class\ Main\ here.\n\n\ @author\ (your\ name)\n\ @version\ (a\ version\ number\ or\ a\ date)\n
4
+comment1.params=args
5
+comment1.target=void\ main(java.lang.String[])
6
+numComments=2

+ 40
- 0
GuessingGame/Main.java Zobrazit soubor

1
+import java.util.*;
2
+
3
+/**
4
+ * Write a description of class Main here.
5
+ *
6
+ * @author (your name)
7
+ * @version (a version number or a date)
8
+ */
9
+public class Main
10
+{ 
11
+
12
+    public static void main(String [] args){
13
+        int counter = 0;
14
+        int usernumber = 0;
15
+        Random random = new Random ();
16
+        int mysterynumber = random.nextInt(11);
17
+
18
+        Scanner input = new Scanner(System.in);
19
+        System.out.println("Hi; welcome to the game!");
20
+
21
+        while(usernumber != mysterynumber) {
22
+            System.out.println("Enter any number between 1 and 10");
23
+            usernumber = input.nextInt();
24
+            counter++;
25
+
26
+            if (usernumber < mysterynumber){
27
+                System.out.println("Too small!");
28
+            }
29
+            else if(usernumber > mysterynumber){
30
+                System.out.println("Too big!");
31
+            }
32
+            else { 
33
+                System.out.println("Congratulations; you are correct!");
34
+            }
35
+        }
36
+        System.out.println("Number of guesses: " + counter);
37
+        
38
+
39
+    }
40
+}

binární
GuessingGame/MainTest.class Zobrazit soubor


+ 13
- 0
GuessingGame/MainTest.ctxt Zobrazit soubor

1
+#BlueJ class context
2
+comment0.target=MainTest
3
+comment0.text=\n\ The\ test\ class\ MainTest.\n\n\ @author\ \ (your\ name)\n\ @version\ (a\ version\ number\ or\ a\ date)\n
4
+comment1.params=
5
+comment1.target=MainTest()
6
+comment1.text=\n\ Default\ constructor\ for\ test\ class\ MainTest\n
7
+comment2.params=
8
+comment2.target=void\ setUp()
9
+comment2.text=\n\ Sets\ up\ the\ test\ fixture.\n\n\ Called\ before\ every\ test\ case\ method.\n
10
+comment3.params=
11
+comment3.target=void\ tearDown()
12
+comment3.text=\n\ Tears\ down\ the\ test\ fixture.\n\n\ Called\ after\ every\ test\ case\ method.\n
13
+numComments=4

+ 42
- 0
GuessingGame/MainTest.java Zobrazit soubor

1
+
2
+
3
+import static org.junit.Assert.*;
4
+import org.junit.After;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+/**
9
+ * The test class MainTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class MainTest
15
+{
16
+    /**
17
+     * Default constructor for test class MainTest
18
+     */
19
+    public MainTest()
20
+    {
21
+    }
22
+
23
+    /**
24
+     * Sets up the test fixture.
25
+     *
26
+     * Called before every test case method.
27
+     */
28
+    @Before
29
+    public void setUp()
30
+    {
31
+    }
32
+
33
+    /**
34
+     * Tears down the test fixture.
35
+     *
36
+     * Called after every test case method.
37
+     */
38
+    @After
39
+    public void tearDown()
40
+    {
41
+    }
42
+}

+ 12
- 0
GuessingGame/README.TXT Zobrazit soubor

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:

+ 40
- 0
GuessingGame/package.bluej Zobrazit soubor

1
+#BlueJ package file
2
+editor.fx.0.height=722
3
+editor.fx.0.width=800
4
+editor.fx.0.x=504
5
+editor.fx.0.y=37
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=40
13
+package.editor.y=77
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=MainTest
28
+target1.showInterface=false
29
+target1.type=UnitTestTargetJunit4
30
+target1.width=80
31
+target1.x=100
32
+target1.y=50
33
+target2.association=MainTest
34
+target2.height=50
35
+target2.name=Main
36
+target2.showInterface=false
37
+target2.type=ClassTarget
38
+target2.width=80
39
+target2.x=70
40
+target2.y=80