Skip to content

Commit

Permalink
A-Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
bklimey committed Aug 30, 2021
1 parent 7f2dbc1 commit c57e961
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Duke project template
# duke.duke project template

This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.

Expand All @@ -13,7 +13,7 @@ Prerequisites: JDK 11, update Intellij to the most recent version.
1. If there are any further prompts, accept the defaults.
1. Configure the project to use **JDK 11** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).<br>
In the same dialog, set the **Project language level** field to the `SDK default` option.
3. After that, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
3. After that, locate the `src/main/java/duke.duke.java` file, right-click it, and choose `Run duke.duke.main()` (if the code editor is showing compile errors, try restarting the IDE). If the setup is correct, you should see something like the below as the output:
```
Hello from
____ _
Expand Down
Empty file added data/duke.txt
Empty file.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

public enum Command {
DONE {
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

public class Deadline extends Task {

protected String by;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/Duke.java → src/main/java/duke/Duke.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

public class Duke {
public static void main(String[] args) {
Ui.run();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

public class DukeException extends Exception {
public DukeException(String message) {
super(message);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/Event.java → src/main/java/duke/Event.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

public class Event extends Task {

protected String at;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/Parser.java → src/main/java/duke/Parser.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

public class Parser {

public static void process(String userInput) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

import java.io.File;
import java.io.FileWriter;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -40,7 +42,7 @@ private static Task convertStringToTask(String taskString) throws IllegalArgumen
String taskType = taskString.substring(0,firstBarIndex).strip();
if (!VALID_TASK_TYPE.contains(taskType)) {
System.out.println(taskType);
throw new IllegalArgumentException("Invalid Task Type (Expects: T, D or E)");
throw new IllegalArgumentException("Invalid Duke.Task Type (Expects: T, D or E)");
}
int secondBarIndex = taskString.indexOf("|", firstBarIndex + 1);
if (secondBarIndex == -1) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/Task.java → src/main/java/duke/Task.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

public class Task {
protected String description;
protected boolean isDone;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

import java.io.FileNotFoundException;
import java.util.List;
import java.util.ArrayList;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/Todo.java → src/main/java/duke/Todo.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

public class Todo extends Task {

public Todo(String description) {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/Ui.java → src/main/java/duke/Ui.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package duke;

import java.util.Scanner;

public class Ui {
Expand All @@ -13,12 +15,12 @@ public static void run() {
userList = TaskList.load();
} catch (Exception exception) {
System.out.println(exception);
System.out.println("Task list not found.");
System.out.println("Duke.Task list not found.");
userList = new TaskList();
System.out.println("New task list created");
}

System.out.println("Hello! I'm Duke");
System.out.println("Hello! I'm Duke.Duke");
System.out.println("What can I do for you?");

Scanner sc = new Scanner(System.in);
Expand Down
2 changes: 1 addition & 1 deletion text-ui-test/EXPECTED.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Hello from
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|

Hello! I'm Duke
Hello! I'm duke.duke
What can I do for you?
Got it. I've added this task:
[T][ ] borrow book
Expand Down
2 changes: 1 addition & 1 deletion text-ui-test/runtest.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ IF ERRORLEVEL 1 (
REM no error here, errorlevel == 0

REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT
java -classpath ..\bin Duke < input.txt > ACTUAL.TXT
java -classpath ..\bin duke.duke < input.txt > ACTUAL.TXT

REM compare the output to the expected output
FC ACTUAL.TXT EXPECTED.TXT
Expand Down

0 comments on commit c57e961

Please sign in to comment.