#36 completed too large too small

Открыто
sambhutani хочет смерджить 1 коммит(ов) из sambhutani/ZCW-TooLargeTooSmall-BlueJ:master в master
6 измененных файлов: 93 добавлений и 0 удалений
  1. Двоичные данные
      .DS_Store
  2. Двоичные данные
      MyGuessingGame/MyGuessingGame.class
  3. 5
    0
      MyGuessingGame/MyGuessingGame.ctxt
  4. 44
    0
      MyGuessingGame/MyGuessingGame.java
  5. 12
    0
      MyGuessingGame/README.TXT
  6. 32
    0
      MyGuessingGame/package.bluej

Двоичные данные
.DS_Store Просмотреть файл


Двоичные данные
MyGuessingGame/MyGuessingGame.class Просмотреть файл


+ 5
- 0
MyGuessingGame/MyGuessingGame.ctxt Просмотреть файл

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

+ 44
- 0
MyGuessingGame/MyGuessingGame.java Просмотреть файл

@@ -0,0 +1,44 @@
1
+
2
+/**
3
+ * Write a description of class MyGuessingGame here.
4
+ *
5
+ * @Simran Bhutani
6
+ * @version 1 - Oct 22 2018
7
+ */
8
+import java.util.Random;
9
+import java.util.Scanner;
10
+public class MyGuessingGame
11
+{
12
+    public static void main(String[] args){
13
+        Random rnum= new Random();
14
+        int rNumber= rnum.nextInt(5);
15
+        int numberOfGuesses=0;
16
+        int previousGuess=0;
17
+        Scanner enternum=new Scanner(System.in);
18
+        int myGuess;
19
+        boolean rightGuess= false;
20
+        while(rightGuess== false)
21
+        {
22
+        System.out.println("Enter a number to guess between 1 and 5");
23
+        myGuess=enternum.nextInt();
24
+        if(previousGuess!=myGuess){
25
+        numberOfGuesses= numberOfGuesses+1;}
26
+        
27
+        if(myGuess == rNumber)
28
+        {
29
+            rightGuess= true;
30
+            System.out.println("Correct Guess");
31
+        }
32
+        else if(myGuess < rNumber)
33
+        {
34
+           System.out.println("Too small"); 
35
+        }
36
+        else if(myGuess> rNumber)
37
+        {
38
+           System.out.println("Too large");
39
+        }
40
+        previousGuess=myGuess;
41
+        }
42
+        System.out.println("Number of guesses you took: " +numberOfGuesses);
43
+    }
44
+}

+ 12
- 0
MyGuessingGame/README.TXT Просмотреть файл

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

+ 32
- 0
MyGuessingGame/package.bluej Просмотреть файл

@@ -0,0 +1,32 @@
1
+#BlueJ package file
2
+editor.fx.0.height=722
3
+editor.fx.0.width=800
4
+editor.fx.0.x=640
5
+editor.fx.0.y=23
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=320
13
+package.editor.y=184
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=MyGuessingGame
28
+target1.showInterface=false
29
+target1.type=ClassTarget
30
+target1.width=140
31
+target1.x=70
32
+target1.y=10