Repository navigation
Expand file tree
/
Copy pathmithran
More file actions
66 lines (45 loc) · 1.82 KB
/
Copy pathmithran
File metadata and controls
66 lines (45 loc) · 1.82 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//import java.util.Scanner();
import java.util.*;
import java.util.Scanner;
public class ScannerExample {
public static void main(String[] args) {
// Create a Scanner object to read input from the console
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = scanner.nextLine();
System.out.println("Hello, " + name);
System.out.println("what is the secoret worde");
String worde = scanner.nextLine();
System.out.println("you are at a crossroad. Do you go (1) left or (2) right?");
int choice=scanner.nextInt();
if (choice == 1){
System.out.println("You go left.");
System.out.println("you are at a crossroad. Do you go (1) River or (2)forest?");
choice=scanner.nextInt();
if(choice==1){
System.out.println("you see a river");
if (worde.equals("magic")){
System.out.println("ther is a magical brige");
} else {
System.out.println("the water is to big so go home");
}
} else {
System.out.println("you see a forest");
}
if (worde.equals("friend"))
{
System.out.println("Friendly animals greet and show you the way out");
} else {
System.out.println("Friendly animals eat you.");
}
}
else
System.out.println("You go right.");
int itemsFound = 0;
if (itemsFound = itemsFound + 1)
else
(itemsFound++)
System.out.println("You found [itemsFound] special items on your journey!");
}
input.close()
}