From 149ef9a3a46471c136470d24532164ac6059daec Mon Sep 17 00:00:00 2001 From: Kthomas Date: Fri, 9 Feb 2018 13:24:01 -0500 Subject: [PATCH 1/2] First commit --- src/main/java/Main.java | 55 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 05e41a9..a21db85 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -1,9 +1,54 @@ -/** - * Created by iyasuwatts on 10/17/17. - */ +import java.util.Scanner; +import java.util.Random; + public class Main { - public static void main(String[] args){ - + public static void main(String[] args) { + Random generator = new Random(); + Scanner reader = new Scanner(System.in); + int solution = generator.nextInt(100); + int tryCounter = 0; + + System.out.print("What number am I thinking of?...\n "); + + int input = reader.nextInt(); + + while (input != solution){ + + + if (input > solution) { + + System.out.print("Thats too high try again\n> "); + input = reader.nextInt(); + } + else if (input < solution) { + + System.out.println("Thats too low try again\n> "); + input = reader.nextInt(); + } + } + System.out.print("Damn you're pretty good!"); } + // System.out.println(tryCounter); } + + + + + + + + + + + + + + + + + + + + + From 8270f952ad3f9c6d942a8f0bfbfa50e86a0dbc41 Mon Sep 17 00:00:00 2001 From: Kthomas Date: Tue, 27 Feb 2018 13:44:43 -0500 Subject: [PATCH 2/2] Cleaner --- src/main/java/Main.java | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/main/java/Main.java b/src/main/java/Main.java index a21db85..6a8a131 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -2,22 +2,15 @@ import java.util.Random; public class Main { - public static void main(String[] args) { Random generator = new Random(); Scanner reader = new Scanner(System.in); int solution = generator.nextInt(100); int tryCounter = 0; - System.out.print("What number am I thinking of?...\n "); - int input = reader.nextInt(); - while (input != solution){ - - if (input > solution) { - System.out.print("Thats too high try again\n> "); input = reader.nextInt(); } @@ -30,25 +23,4 @@ else if (input < solution) { System.out.print("Damn you're pretty good!"); } // System.out.println(tryCounter); -} - - - - - - - - - - - - - - - - - - - - - +} \ No newline at end of file