From 2f4a26500cd67ee7dd28c8b2de3aa2754ec9f113 Mon Sep 17 00:00:00 2001 From: TesterSzymoon <47006674+TesterSzymoon@users.noreply.github.com> Date: Wed, 27 Nov 2019 14:35:37 +0100 Subject: [PATCH] Create Main.java --- hworld/impl/Main.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 hworld/impl/Main.java diff --git a/hworld/impl/Main.java b/hworld/impl/Main.java new file mode 100644 index 0000000..e567e29 --- /dev/null +++ b/hworld/impl/Main.java @@ -0,0 +1,30 @@ +import java.util.Scanner; + +class Main { + public static void main(String[] args) { + interpreter(); + } + public static void interpreter() { + String cmnd = ""; + Scanner scan = new Scanner(System.in); + do { + cmnd = scan.nextLine(); + if(cmnd.equalsIgnoreCase("h")) { + System.out.println("Hello!"); + } else if (cmnd.equalsIgnoreCase("hh")) { + System.out.println("Hello, Hello!"); + } else if(cmnd.equalsIgnoreCase("w")) { + System.out.println("World!"); + } else if(cmnd.equalsIgnoreCase("ww")) { + System.out.println("World, World!"); + } else if(cmnd.equalsIgnoreCase("wh")) { + System.out.println("World, Hello!"); + } else if(cmnd.equalsIgnoreCase("hw")) { + System.out.println("Hello, World!"); + } else { + System.out.println(cmnd); + } + } while (!cmnd.equalsIgnoreCase("q")); + scan.close(); + } +}