From 82f7e4a0bc7a9ab67dcc026eb7814ae3b58a658f Mon Sep 17 00:00:00 2001 From: seanngja Date: Fri, 30 Aug 2024 17:55:14 +0800 Subject: [PATCH] Update code to improve readability --- Contacts.iml | 11 +++++++++++ src/main/java/Contacts0.java | 20 +++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 Contacts.iml diff --git a/Contacts.iml b/Contacts.iml new file mode 100644 index 0000000..f76df2b --- /dev/null +++ b/Contacts.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/Contacts0.java b/src/main/java/Contacts0.java index e23d58a..b0ca726 100644 --- a/src/main/java/Contacts0.java +++ b/src/main/java/Contacts0.java @@ -3,15 +3,13 @@ public class Contacts0 { + public static final int MAX_ENTITIES = 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]; - int count = 0; + printWelcomeMessage(); + String[][] list = new String[MAX_ENTITIES][3]; + int count = 0; while (true) { System.out.print("|| " + "Enter command: "); String inputLine = SCANNER.nextLine(); @@ -146,4 +144,12 @@ public static void main(String[] args) { } } + 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("|| ==================================================="); + } + } \ No newline at end of file