diff --git a/src/main/java/Contacts0.java b/src/main/java/Contacts0.java index e23d58a..d49847c 100644 --- a/src/main/java/Contacts0.java +++ b/src/main/java/Contacts0.java @@ -3,14 +3,13 @@ public class Contacts0 { + public static final int MAX_ENTITIES = 100; + public static final String SEPARATOR = "==================================================="; + public static void main(String[] args) { final Scanner SCANNER = new Scanner(System.in); - System.out.println("|| ==================================================="); - System.out.println("|| ==================================================="); - System.out.println("|| Contacts - Version 0.0"); - System.out.println("|| Welcome to Contacts!"); - System.out.println("|| ==================================================="); - String[][] list = new String[100][3]; + printWelcomeScreen(); + String[][] list = new String[MAX_ENTITIES][3]; int count = 0; while (true) { System.out.print("|| " + "Enter command: "); @@ -92,7 +91,7 @@ public static void main(String[] args) { feedback = String.format("%1$d persons found!", count); break; case "clear": - list = new String[100][3]; + list = new String[MAX_ENTITIES][3]; count = 0; feedback = "Contacts have been cleared!"; break; @@ -113,8 +112,8 @@ public static void main(String[] args) { break; case "exit": for (String m1 : new String[]{"Exiting Contacts... Good bye!", - "===================================================", - "==================================================="}) { + SEPARATOR, + SEPARATOR}) { System.out.println("|| " + m1); } System.exit(0); @@ -140,10 +139,18 @@ public static void main(String[] args) { + String.format("\tExample: %1$s", "help"))); break; } - for (String m : new String[]{feedback, "==================================================="}) { + for (String m : new String[]{feedback, SEPARATOR}) { System.out.println("|| " + m); } } } + private static void printWelcomeScreen() { + System.out.println("|| ==================================================="); + System.out.println("|| ==================================================="); + System.out.println("|| Contacts - Version 1.0"); + System.out.println("|| Welcome to Contacts!"); + System.out.println("|| ==================================================="); + } + } \ No newline at end of file diff --git a/textui-test/EXPECTED.TXT b/textui-test/EXPECTED.TXT index 047bf26..7e9849d 100644 --- a/textui-test/EXPECTED.TXT +++ b/textui-test/EXPECTED.TXT @@ -1,6 +1,6 @@ || =================================================== || =================================================== -|| Contacts - Version 0.0 +|| Contacts - Version 1.0 || Welcome to Contacts! || =================================================== || Enter command: || [Command entered:help]