-
Notifications
You must be signed in to change notification settings - Fork 0
/
Number_Guesser.java
43 lines (35 loc) · 1.48 KB
/
Number_Guesser.java
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
41
42
43
/*
* Prajeet
* 12/05/2023
* Project 1
*/
import java.util.*;
public class Number_Guesser {
public static void main(String[] args)
{
Scanner scanner = new Scanner (System.in);
Random randGen = new Random();
System.out.println("Think of a Random Number");
System.out.println("Press Y when you are ready!");
String response1 = scanner.nextLine();
if (response1.equalsIgnoreCase("y")){
System.out.println("Now double this number!");
System.out.println("Press Y when you are ready!");
String response2 = scanner.nextLine();
if (response2.equalsIgnoreCase("y")){
int randomNumber = randGen.nextInt();
System.out.println("Now add "+ randomNumber+ " to this number!");
System.out.println("Press Y when you are ready!");
String response3 = scanner.nextLine();
if(response2.equalsIgnoreCase("y")){
System.out.println("Now half this number that you have in "
+ "your mind");
System.out.println("Press Y when you are ready!");
String response4 = scanner.nextLine();
double finalr = ((double)randomNumber/2);
System.out.println("VIOALA the number in your mind is "+ finalr);
}
}
}
}
}