diff --git a/.gitignore b/.gitignore index 42cfd87..23b5426 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ hs_err_pid* replay_pid* .idea/ textui-test/ACTUAL.TXT + +*.iml diff --git a/src/main/java/Contacts0.java b/src/main/java/Contacts0.java index e23d58a..c941e2b 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]; + printWelcomeMessage(); + 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); } } } -} \ No newline at end of file + private static void printWelcomeMessage() { + System.out.println("|| ==================================================="); + System.out.println("|| ==================================================="); + System.out.println("|| Contacts - Version 0.0"); + System.out.println("|| Welcome to Contacts!"); + System.out.println("|| ==================================================="); + } + +} diff --git a/src/main/java/Contacts1.java b/src/main/java/Contacts1.java index dcadc2c..7bba8f3 100644 --- a/src/main/java/Contacts1.java +++ b/src/main/java/Contacts1.java @@ -673,4 +673,4 @@ private static String removePrefixSign(String s, String sign) { return s.replace(sign, ""); } -} \ No newline at end of file +} diff --git a/textui-test/runtest.sh b/textui-test/runtest.sh old mode 100644 new mode 100755