From 44f718cec1050f094780e330018b3c4c39bde5bb Mon Sep 17 00:00:00 2001 From: Akshay Narayan Date: Thu, 27 Aug 2020 14:32:45 +0800 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 113f058..f94a6c4 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# Lender Project \ No newline at end of file +# Contacts Project From 26ff21aa62b9e387e984aef91bfa42da8f4e2ef1 Mon Sep 17 00:00:00 2001 From: Akshay Narayan Date: Fri, 28 Aug 2020 15:23:20 +0800 Subject: [PATCH 2/3] Update Contacts1.java --- src/main/java/Contacts1.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/Contacts1.java b/src/main/java/Contacts1.java index 8ede41d..4f2d805 100644 --- a/src/main/java/Contacts1.java +++ b/src/main/java/Contacts1.java @@ -1,11 +1,3 @@ - -/* - * NOTE : ============================================================= - * This class is written in a procedural fashion (i.e. not Object-Oriented) - * Yes, it is possible to write non-OO code using an OO language. - * ==================================================================== - */ - import java.util.Scanner; From 378ef4f0bd3c7f21e0e8f73c46fc0d47493b0fdf Mon Sep 17 00:00:00 2001 From: R Ramana Date: Fri, 28 Aug 2020 17:41:13 +0800 Subject: [PATCH 3/3] Refactor code --- src/main/java/Contacts0.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 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("|| ==================================================="); + } + }