diff --git a/.idea/misc.xml b/.idea/misc.xml index cf9abe6..cbbff6a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/GuessStarter.java b/src/GuessStarter.java index 64984df..5cfb13e 100644 --- a/src/GuessStarter.java +++ b/src/GuessStarter.java @@ -1,5 +1,11 @@ +/** + * @author Trevor Hartman + * @author Andrew Escarcega + * + * @since 02/04/24 + */ import java.util.Random; - +import java.util.Scanner; /** * Starter code for the "Guess My Number" exercise. */ @@ -9,7 +15,19 @@ public static void main(String[] args) { // pick a random number Random random = new Random(); int number = random.nextInt(100) + 1; - System.out.println(number); + + System.out.println("I'm thinking of a number between 1 and 100 (including both). Can you guess what it is?"); + System.out.print("Enter number: "); + int numberG; + Scanner scan = new Scanner(System.in); + numberG = scan.nextInt(); + + System.out.println("Your guess was " + numberG); + System.out.println("The number I was thinking of is " + number); + int difference = Math.abs(number - numberG); + //looked up how to make it so that a number is not negative in java not sure if there is a better way + System.out.println("The difference between your guess and the number I was thinking of is " + difference); + } }