From 0b7a85f5154fb5a70818a1d803ea00c32fca97a2 Mon Sep 17 00:00:00 2001 From: anqi20 Date: Fri, 28 Aug 2020 18:01:38 +0800 Subject: [PATCH] Refactoring --- src/main/java/Contacts0.java | 18 ++++++++++++------ text-ui-test/EXPECTED.txt | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/Contacts0.java b/src/main/java/Contacts0.java index 212842f..3b2c763 100644 --- a/src/main/java/Contacts0.java +++ b/src/main/java/Contacts0.java @@ -3,14 +3,12 @@ public class Contacts0 { + public static final int MAX_CAPACITY = 100; + 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]; + showWelcomeScreen(); + String[][] list = new String[MAX_CAPACITY][3]; int count = 0; while (true) { System.out.print("|| " + "Enter command: "); @@ -146,4 +144,12 @@ public static void main(String[] args) { } } + private static void showWelcomeScreen() { + 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/text-ui-test/EXPECTED.txt b/text-ui-test/EXPECTED.txt index 047bf26..78b1aa7 100644 --- a/text-ui-test/EXPECTED.txt +++ b/text-ui-test/EXPECTED.txt @@ -1,12 +1,12 @@ || =================================================== || =================================================== -|| Contacts - Version 0.0 +|| Contacts - Version 0.1 || Welcome to Contacts! || =================================================== || Enter command: || [Command entered:help] || add: Adds a person to contacts. || Parameters: NAME p/PHONE_NUMBER e/EMAIL -|| Example: add John Doe p/98765432 e/johnd@gmail.com +|| Example: add John Doe p/98765431 e/johnd@gmail.com || || list: Displays all persons as a list with index numbers. || Example: list