Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR exercise #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/main/java/Contacts0.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import java.util.Scanner;


//asdasdasdasdasdasd
public class Contacts0 {

public static final int MAX = 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];

String[][] list = new String[MAX][3];
int count = 0;
while (true) {
System.out.print("|| " + "Enter command: ");
Expand Down Expand Up @@ -62,7 +63,7 @@ public static void main(String[] args) {
&& !person1[2].isEmpty() && person1[2].contains("@") ? person1 : null;
}
if (decodeResult == null) {
feedback = String.format("Invalid command format: %1$s " + (System.lineSeparator() + "|| ")
feedback = String.format("Invalid command format: %1$s " + (System.lineSeparator() + "|| ")
+ "%2$s", "add", String.format("%1$s: %2$s", "add", "Adds a person to contacts.") + (System.lineSeparator() + "|| ")
+ String.format("\tParameters: %1$s", "NAME "
+ "p/" + "PHONE_NUMBER "
Expand Down Expand Up @@ -92,7 +93,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][3];
count = 0;
feedback = "Contacts have been cleared!";
break;
Expand All @@ -106,9 +107,9 @@ public static void main(String[] args) {
+ String.format("\tExample: %1$s", "list") + (System.lineSeparator() + "|| ")) + (System.lineSeparator() + "|| ")
+ (String.format("%1$s: %2$s", "clear", "Clears all contacts.") + (System.lineSeparator() + "|| ")
+ String.format("\tExample: %1$s", "clear") + (System.lineSeparator() + "|| ")) + (System.lineSeparator() + "|| ")
+ (String.format("%1$s: %2$s", "exit", "Exits the program.")+ (System.lineSeparator() + "|| ")
+ (String.format("%1$s: %2$s", "exit", "Exits the program.") + (System.lineSeparator() + "|| ")
+ String.format("\tExample: %1$s", "exit")) + (System.lineSeparator() + "|| ") + (System.lineSeparator() + "|| ")
+ (String.format("%1$s: %2$s", "help", "Shows program usage instructions.")+ (System.lineSeparator() + "|| ")
+ (String.format("%1$s: %2$s", "help", "Shows program usage instructions.") + (System.lineSeparator() + "|| ")
+ String.format("\tExample: %1$s", "help"));
break;
case "exit":
Expand All @@ -120,7 +121,7 @@ public static void main(String[] args) {
System.exit(0);
// Fallthrough
default:
feedback = String.format("Invalid command format: %1$s " + (System.lineSeparator() + "|| ")
feedback = String.format("Invalid command format: %1$s " + (System.lineSeparator() + "|| ")
+ "%2$s", commandType, (String.format("%1$s: %2$s", "add", "Adds a person to contacts.") + (System.lineSeparator() + "|| ")
+ String.format("\tParameters: %1$s", "NAME "
+ "p/" + "PHONE_NUMBER "
Expand All @@ -140,7 +141,7 @@ 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, "===================================================="}) {
System.out.println("|| " + m);
}
}
Expand Down