diff --git a/Greeting.java b/Greeting.java new file mode 100644 index 0000000..3c8be62 --- /dev/null +++ b/Greeting.java @@ -0,0 +1,6 @@ +public class Greeting { + public void greeting() { + System.out.println("Welcome to cflash!"); + System.out.println("Would you like to flash an image (Y/n)"); + } +} diff --git a/Main.java b/Main.java new file mode 100644 index 0000000..5c64a51 --- /dev/null +++ b/Main.java @@ -0,0 +1,19 @@ +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + Scanner UserInput = new Scanner(System.in); + + greeting(); + String input = UserInput.nextLine(); + + if (YesNo.check(input)) { + System.out.println("Please choose a device"); + } else { + System.out.println("Canceling..."); + System.exit(0); + } + + + } +} diff --git a/YesNo.java b/YesNo.java new file mode 100644 index 0000000..5280bc9 --- /dev/null +++ b/YesNo.java @@ -0,0 +1,16 @@ +public class YesNo { + public static boolean check(String input) { + switch (input) { + case "Y": + return true; + case "y": + return true; + case "": + return true; + case "n": + return false; + default: + return false; + } + } +}