Skip to content

Commit 4eb84f4

Browse files
committed
Initial Commit
1 parent dc84b7b commit 4eb84f4

File tree

14 files changed

+283
-65
lines changed

14 files changed

+283
-65
lines changed

.gitattributes

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 43 deletions
This file was deleted.

Scr1.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
public class Scr1 {
3+
public static void main(String args[]){
4+
System.out.println("Welcome to the game!");
5+
}
6+
}

Scr10.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import java.util.Scanner;
2+
3+
4+
public class Scr10 {
5+
public static void main(String args[]){
6+
String[] items = new String[10];
7+
items[0] = "apple";
8+
int x = 12;
9+
boolean isMorning = true;
10+
String location = "house";
11+
Scanner sc = new Scanner(System.in);
12+
System.out.println("Welcome to the game!");
13+
System.out.println("The current time is: " + x + " O'clock");
14+
System.out.println("You are located at: " + location);
15+
System.out.println("Morning: " + isMorning);
16+
System.out.println("Item 1: "+ items[0]);
17+
System.out.println("Enter command");
18+
while(true){
19+
String input = sc.nextLine();
20+
switch(input){
21+
case "hello": System.out.println("hello there");
22+
break;
23+
case "exit": System.out.println("come again sometime!");
24+
break;
25+
default: System.out.println("what?");
26+
}
27+
}
28+
}
29+
}

Scr11.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import java.util.Scanner;
2+
3+
4+
public class Scr11 {
5+
public static void main(String args[]){
6+
String[] items = new String[10];
7+
items[0] = "apple";
8+
int x = 12;
9+
boolean isMorning = true;
10+
String location = "house";
11+
Scanner sc = new Scanner(System.in);
12+
System.out.println("Welcome to the game!");
13+
System.out.println("The current time is: " + x + " O'clock");
14+
System.out.println("You are located at: " + location);
15+
System.out.println("Morning: " + isMorning);
16+
System.out.println("Item 1: "+ items[0]);
17+
System.out.println("Enter command");
18+
while(true){
19+
String input = sc.nextLine();
20+
switch(input){
21+
case "hello": System.out.println("hello there");
22+
break;
23+
case "exit": System.out.println("come again sometime!");
24+
break;
25+
case "open door": if(location.equals("house")){
26+
location = "lawn";
27+
}
28+
break;
29+
case "eat": if(items[0].equals("apple")){
30+
System.out.println("you eat, and feel more energized.");
31+
items[0] = "apple core";
32+
}
33+
break;
34+
case "look":
35+
switch(location){
36+
case "house": System.out.println("You are in a small wooden house. You can see"
37+
+ " the front door");
38+
case "lawn": System.out.println("You are on a front lawn, a house behind you.");
39+
}
40+
default: System.out.println("what?");
41+
}
42+
}
43+
}
44+
}

Scr12.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import java.util.Scanner;
2+
3+
4+
public class Scr12 {
5+
public static void main(String args[]){
6+
String[] items = new String[10];
7+
items[0] = "apple";
8+
int x = 12;
9+
boolean isMorning = true;
10+
String location = "house";
11+
Scanner sc = new Scanner(System.in);
12+
System.out.println("Welcome to the game!");
13+
System.out.println("The current time is: " + x + " O'clock");
14+
System.out.println("You are located at: " + location);
15+
System.out.println("Morning: " + isMorning);
16+
System.out.println("Item 1: "+ items[0]);
17+
System.out.println("Enter command");
18+
while(true){
19+
String input = sc.nextLine();
20+
switch(input){
21+
case "hello": System.out.println("hello there");
22+
break;
23+
case "exit": System.out.println("come again sometime!");
24+
break;
25+
case "open door": if(location.equals("house")){
26+
location = "lawn";
27+
}
28+
break;
29+
case "look":
30+
switch(location){
31+
case "house": System.out.println("You are in a small wooden house. You can see"
32+
+ " the front door");
33+
case "lawn": System.out.println("You are on a front lawn, a house behind you.");
34+
}
35+
default: System.out.println("what?");
36+
}
37+
}
38+
}
39+
}

Scr2.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
public class Scr2 {
3+
public static void main(String args[]){
4+
int x = 12;
5+
System.out.println("Welcome to the game!");
6+
System.out.println("The current time is: " + x + " O'clock");
7+
}
8+
}

Scr3.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
public class Scr3 {
3+
public static void main(String args[]){
4+
int x = 12;
5+
boolean isMorning = true;
6+
String location = "house";
7+
System.out.println("Welcome to the game!");
8+
System.out.println("The current time is: " + x + " O'clock");
9+
System.out.println("You are located at: " + location);
10+
System.out.println("Morning: " + isMorning);
11+
}
12+
}

Scr4.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
public class Scr4 {
3+
public static void main(String args[]){
4+
String[] items = new String[10];
5+
items[0] = "apple";
6+
int x = 12;
7+
boolean isMorning = true;
8+
String location = "house";
9+
System.out.println("Welcome to the game!");
10+
System.out.println("The current time is: " + x + " O'clock");
11+
System.out.println("You are located at: " + location);
12+
System.out.println("Morning: " + isMorning);
13+
System.out.println("Item 1: "+ items[0]);
14+
}
15+
}

Scr5.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import java.util.Scanner;
2+
3+
4+
public class Scr5 {
5+
public static void main(String args[]){
6+
String[] items = new String[10];
7+
items[0] = "apple";
8+
int x = 12;
9+
boolean isMorning = true;
10+
String location = "house";
11+
Scanner sc = new Scanner(System.in);
12+
System.out.println("Welcome to the game!");
13+
System.out.println("The current time is: " + x + " O'clock");
14+
System.out.println("You are located at: " + location);
15+
System.out.println("Morning: " + isMorning);
16+
System.out.println("Item 1: "+ items[0]);
17+
System.out.println("Enter command");
18+
String input = sc.nextLine();
19+
System.out.println(input);
20+
sc.close();
21+
}
22+
}

0 commit comments

Comments
 (0)