-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathMain.java
More file actions
43 lines (35 loc) · 1.09 KB
/
Main.java
File metadata and controls
43 lines (35 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.Random;
import java.util.Scanner;
/**
* Created by iyasuwatts on 10/17/17.
*/
public class Main {
//public static String PrintResult(int userInput){
//if(userInput < 5){
//System.out.println("too small")
// }
//}
public static void main(String[] args){
System.out.println("Zipcode rocks!");
int userInput;
Scanner in = new Scanner (System. in);
System.out.print ("Guess a number: ");
userInput = in.nextInt();
Math.random();
Random num = new Random();
int randomNum1 = num.nextInt(10);
int userInputCount = 0;
userInputCount++;
System.out.println(userInputCount);
boolean correctGuess = false;
while (!correctGuess) {
if (userInput == randomNum1) {
System.out.println("correct guess");
} else if (userInput > randomNum1) {
System.out.println("too large"); }
else if (userInput < randomNum1)
{System.out.println("too small");
}
}
}
}