Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
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
# Growler 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 17, update Intellij to the most recent version.
1. If there are any further prompts, accept the defaults.
1. Configure the project to use **JDK 17** (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.
1. 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:
1. After that, locate the `src/main/java/Growler.java` file, right-click it, and choose `Run Growler.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
2 changes: 2 additions & 0 deletions data/Growler.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
T | 0 | return book
T | 0 | return book
98 changes: 82 additions & 16 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,96 @@
# Duke User Guide
# Growler Project
**A Java-based CLI task management assistant**

// Update the title above to match the actual product name
---

// Product screenshot goes here
## **Introduction**
**Growler** is a simple and interactive **command-line chatbot** that helps you manage your daily tasks efficiently. You can add different types of tasks, mark them as done, and list them in an organized manner. Growler is built using Java and adopts a step by step development process.

// Product intro goes here
---

## Adding deadlines
### **Features**
- **Task Management**
- **ToDo**: Simple tasks without a date (e.g., `todo read book`)
- **Deadline**: Tasks with a due date (e.g., `deadline submit assignment /by Sunday`)
- **Event**: Tasks with a start and end time (e.g., `event group meeting /from 9pm /to 11pm`)
- **Task Completion**
- Mark tasks as done (`mark 2`) or not done (`unmark 2`), according to the index of the task
- **Task Search**
- Finds and displays all tasks which contains a keyword (e.g., `find book`)
- **Task Deletion**
- Deletes task according to its index (e.g., `delete 2`)
- **Task Listing**
- View all added tasks (`list`)
- **User-friendly CLI**
- Growler interacts with users through an easy-to-use command-line interface.

// Describe the action and its outcome.
---

// Give examples of usage
## **Setting Up in IntelliJ IDEA**
### **Prerequisites**
- **JDK 17** (Ensure Java 17 is installed)
- **Latest version of IntelliJ IDEA**

Example: `keyword (optional arguments)`
### **Installation Steps**
1. **Open IntelliJ IDEA**
- If a project is already open, go to `File` > `Close Project` to return to the welcome screen.

// A description of the expected outcome goes here
2. **Import the Project**
- Click **Open**
- Select the project directory
- Click **OK** and accept all default settings.

```
expected output
```
3. **Set up the correct JDK**
- Go to **`File` > `Project Structure` > `Project`**
- Set **Project SDK** to `JDK 17`
- Set **Project language level** to `SDK default`
- Click `Apply` and `OK`

## Feature ABC
4. **Run Growler**
- Navigate to `src/main/java/Istella.java`
- Right-click on `Growler.java`, select **Run 'Growler'**
- If everything is set up correctly, you should see the following output:

// Feature details
Hello! I'm Growler

What can I do for you?

## Feature XYZ

// Feature details
---

## **Usage Guide**
Here are some example commands to interact with Growler:

| **Command** | **Description** | **Example** |
|----------------------------------------|------------------------------------|------------------------------------------|
| `todo <task>` | Adds a **ToDo** task | `todo buy milk` |
| `deadline <task> /by <date>` | Adds a **Deadline** task | `deadline project submission /by Sunday` |
| `event <task> /from <start> /to <end>` | Adds an **Event** task | `event concert /from 6pm /to 10pm` |
| `list` | Displays all added tasks | `list` |
| `mark <task number>` | Marks a task as done | `mark 2` |
| `unmark <task number>` | Marks a task as not done | `unmark 2` |
| `delete <task number>` | Deletes task specified index | `delete 2` |
| `find <keyword>` | Finds all tasks containing keyword | `find book` |
| `bye` | Exits Growler | `bye` |


## **Important Notes**
- **Keep all Java files inside `src/main/java/`**
- Do not rename or move this directory, as tools like Gradle rely on it.
- **Use Java 17**
- Running the project with a different Java version may cause compatibility issues.

---

## **Further Enhancements**
- Implement **reminders** (reminds user of task deadlines/upcoming events)
- Implement **Categorization of tasks** (Categorizes based on work/personal/family/etc)
- Implement **graphical user interface (GUI)** using JavaFX

---

## **Contributing**
Feel free to contribute by:
- Forking the repository
- Adding feature branches
- Submitting pull requests
39 changes: 39 additions & 0 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Represents a task with a deadline.
* A Deadline task has a name and a due date, in addition to the standard task properties.
*/
public class Deadline extends Task {
protected String dueDate;

/**
* Constructs a Deadline task with the specified task name and due date.
*
* @param taskName The name of the task.
* @param dueDate The due date of the task.
*/
public Deadline(String taskName, String dueDate) {
super(taskName);
this.dueDate = dueDate;
}

/**
* Returns a string representation of the Deadline task, including its type,
* task name, and due date.
*
* @return A formatted string representing the Deadline task.
*/
@Override
public String toString() {
return "[D]" + super.toString() + " (by: " + dueDate + ")";
}

/**
* Returns the Deadline task in a format suitable for file storage.
*
* @return A formatted string representing the Deadline task for saving to a file.
*/
@Override
public String toFileFormat() {
return "D | " + (isDone ? "1" : "0") + " | " + taskName + " | " + dueDate;
}
}
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

43 changes: 43 additions & 0 deletions src/main/java/Event.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* The Event class represents a task that occurs between a start date and an end date.
* It extends the Task class and adds fields for the event's start and end dates.
*/
public class Event extends Task {
protected String startDate;
protected String endDate;

/**
* Constructs an Event with the specified task name, start date, and end date.
*
* @param taskName The name of the task.
* @param startDate The start date of the event.
* @param endDate The end date of the event.
*/
public Event(String taskName, String startDate, String endDate) {
super(taskName);
this.startDate = startDate;
this.endDate = endDate;
}

/**
* Returns a string representation of the Event task.
* The format is "[E] <taskName> (from: <startDate> to: <endDate>)".
*
* @return A string representing the Event task in the specified format.
*/
@Override
public String toString(){
return "[E]" + super.toString() + " (from: " + startDate + " to: " + endDate + ")";
}

/**
* Returns the Event task in a format suitable for saving to a file.
* The format is "E | <isDone> | <taskName> | <startDate> | <endDate>".
*
* @return A string representing the Event task in a file-friendly format.
*/
@Override
public String toFileFormat() {
return "E | " + (isDone ? "1" : "0") + " | " + taskName + " | " + startDate + " | " + endDate;
}
}
41 changes: 41 additions & 0 deletions src/main/java/Growler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import java.util.Scanner;

/**
* The Growler class is the main entry point for the Growler application.
* It initializes the necessary components (Storage, Ui, Parser, TaskList) and processes user commands.
* The program runs in a loop until the user types "bye", handling task management operations.
*/
public class Growler {

/**
* The main method starts the Growler application and processes user commands.
* It initializes the storage, UI, parser, and task list, then enters a loop to process commands.
* The loop continues until the user types "bye".
*
* @param args Command-line arguments (not used in this application).
* @throws GrowlerException If there is an error while handling tasks (e.g., invalid task format).
*/
public static void main(String[] args) throws GrowlerException {
Storage storage = new Storage();
Ui ui = new Ui();
Parser parser = new Parser();
Task[] tasks = new Task[100];
int taskCount = storage.loadTasks(tasks); // Load existing tasks from storage
TaskList taskList = new TaskList(tasks, taskCount);
ui.showWelcomeMessage();
Scanner in = new Scanner(System.in);
while (true) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very bad case of arrow head code. I suggest doing more abstraction/ SLAP

String userInput = in.nextLine(); // Get user input
if (userInput.equals("bye")) {
ui.showGoodbyeMessage();
break;
}
try {
parser.handleCommand(userInput, taskList, storage, ui);
} catch (GrowlerException e) {
ui.showError(e.getMessage());
}
}
in.close();
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Decent use of SLAP within your functions
  • Inconsistent naming convention of variables at Line 9
  • Remember to ensure consistency in spacing at Line 31 & 48
  • It is advisable to create more macros for the 'magic' strings in your code

15 changes: 15 additions & 0 deletions src/main/java/GrowlerException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* The GrowlerException class is a custom exception used in the Growler application.
* It extends the {@link Exception} class and allows for handling specific errors that occur in the application.
*/
public class GrowlerException extends Exception {

/**
* Constructs a new GrowlerException with the specified detail message.
*
* @param message The detail message to describe the exception.
*/
public GrowlerException(String message) {
super(message);
}
}
3 changes: 3 additions & 0 deletions src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Growler

Loading