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..c7268e0 100644
--- a/src/GuessStarter.java
+++ b/src/GuessStarter.java
@@ -1,4 +1,6 @@
import java.util.Random;
+import java.util.Scanner;
+import static java.lang.Math.abs;
/**
* Starter code for the "Guess My Number" exercise.
@@ -6,10 +8,22 @@
public class GuessStarter {
public static void main(String[] args) {
+
// pick a random number
Random random = new Random();
int number = random.nextInt(100) + 1;
- System.out.println(number);
+
+ // prompt user to guess a number
+ Scanner entry = new Scanner(System.in);
+ System.out.print("I'm thinking of a number between 1 and 100 (including both). ");
+ System.out.println("Can you guess what it is? ");
+ int guess = entry.nextInt();
+
+ // display user's guess, correct answer, and the difference.
+ int difference = abs(number - guess);
+ System.out.printf("You guessed %d. \n", guess);
+ System.out.printf("The correct number was %d. \n", number);
+ System.out.printf("The difference is %d.", difference);
}
}