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

Update code to improve readability #42

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions contacts.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
21 changes: 14 additions & 7 deletions src/main/java/Contacts0.java
Original file line number Diff line number Diff line change
Expand Up @@ -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];
printWelcomeScreen();
String[][] list = new String[MAX_ENTITIES][3];
int count = 0;
while (true) {
System.out.print("|| " + "Enter command: ");
Expand Down Expand Up @@ -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);
}
}
}

private static void printWelcomeScreen() {
System.out.println("|| ===================================================");
System.out.println("|| ===================================================");
System.out.println("|| Contacts - Version 0.0");
System.out.println("|| Welcome to Contacts!");
System.out.println("|| ===================================================");
}

}
3 changes: 1 addition & 2 deletions src/main/java/Contacts1.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
**/
public class Contacts1 {


/**
* Version info of the program.
*/
Expand Down Expand Up @@ -195,7 +194,7 @@ private static void exitProgram() {
* @param userInputString raw input from user
* @return feedback about how the command was executed
*/
private static String executeCommand(String userInputString) {
private static String executeCommand(String userInputString) {
final String[] commandTypeAndParams = splitCommandWordAndArgs(userInputString);
final String commandType = commandTypeAndParams[0];
final String commandArgs = commandTypeAndParams[1];
Expand Down
Empty file modified textui-test/runtest.bat
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions textui-test/runtest.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ then
mkdir ../bin
fi


# delete output from previous run
if [ -e "./ACTUAL.TXT" ]
then
Expand Down