loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.36338825315146717","path":"Main.java","file":{"path":"Main.java","content":{"asEncoding":{"base64":"aW1wb3J0IGphdmEudXRpbC5TY2FubmVyOwoKY2xhc3MgTWFpbiB7CiAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgU3lzdGVtLm91dC5wcmludGxuKCJcblxuTGV0J3MgcGxheSAyMCBxdWVzdGlvbnMuIENob29zZSBhbiBhbmltYWwgYW5kIEkgd2lsbCB0cnkgdG8gZ3Vlc3MgaXQhIik7CiAgICBTY2FubmVyIHNjYW4gPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwogIAogICAgU3lzdGVtLm91dC5wcmludGxuKCJJcyBpdCBhIG1hbW1hbCAoeS9uKT8iKTsKICAgIFN0cmluZyBhbnN3ZXIgPSBzY2FuLm5leHRMaW5lKCk7CiAgICBpZiAoYW5zd2VyLmVxdWFscygieSIpKSB7CiAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiSXMgaXQgYSBwZXQgKHkvbik/Iik7CiAgICAgIGFuc3dlciA9IHNjYW4ubmV4dExpbmUoKTsKICAgICAgaWYgKGFuc3dlci5lcXVhbHMoInkiKSkgCiAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJJIGd1ZXNzIGEgZG9nISBDbGljayBvbiBydW4gdG8gcGxheSBhZ2Fpbi4iKTsKICAgICAgIGVsc2UgCiAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJJIGd1ZXNzIGFuIGVsZXBoYW50ISBDbGljayBvbiBydW4gdG8gcGxheSBhZ2Fpbi4iKTsgICAKICAgIH0gICAgICAKICAgIGVsc2UgeyAvLyBub3QgYSBtYW1tYWwKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkkgZ3Vlc3MgYSBiaXJkISBDbGljayBvbiBydW4gdG8gcGxheSBhZ2Fpbi4iKTsKICAgICAgfSAgICAgIAogIAoKICB9Cn0="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    System.out.println("\n\nLet's play 20 questions. Choose an animal and I will try to guess it!");
    Scanner scan = new Scanner(System.in);
  
    System.out.println("Is it a mammal (y/n)?");
    String answer = scan.nextLine();
    if (answer.equals("y")) {
      System.out.println("Is it a pet (y/n)?");
      answer = scan.nextLine();
      if (answer.equals("y")) 
           System.out.println("I guess a dog! Click on run to play again.");
       else 
           System.out.println("I guess an elephant! Click on run to play again.");   
    }      
    else { // not a mammal
        System.out.println("I guess a bird! Click on run to play again.");
      }      
  

  }
}