Skip to content

Commit

Permalink
commit for jar
Browse files Browse the repository at this point in the history
  • Loading branch information
Howlong11 committed Feb 7, 2024
1 parent 90a138b commit 8a954d1
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
/**
* Class to initiate the LEMONA task manager
*/
public class Duke {

/**
* The main method to start the Duke application.
* Creates an instance of Lemona task manager and runs it.
*
* @param args Command-line arguments (not used).
*/
public static void main(String[] args) {
Lemona lemona = new Lemona("data/lemona.txt");
lemona.run();
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/Lemona.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@
import task.Event;
import task.Deadline;

/**
* The main class representing the Lemona task manager application.
* Lemona allows users to manage their tasks by adding, listing, marking, and deleting tasks.
* It also provides the functionality to save tasks to a file and load tasks from a file.
*/
public class Lemona {
private Storage storage;
private TaskList tasks;
private Ui ui;

/**
* Constructs a Lemona object with the specified file path for task storage.
*
* @param filePath The file path to store tasks.
*/
public Lemona(String filePath) {
ui = new Ui();
storage = new Storage(filePath);
Expand All @@ -23,6 +33,13 @@ public Lemona(String filePath) {
tasks = new TaskList();
}
}

/**
* Runs the Lemona application.
* Displays a welcome message and continuously waits for user input.
* Processes user commands and performs corresponding actions.
* Exits the application when the "bye" command is entered.
*/
public void run() {
ui.greet();
while (true) {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/Task/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@

import oop.Ui;

/**
* Represents a task with a deadline in the task manager application.
* A deadline task has a description and a due date.
*/
public class Deadline extends Task{
private LocalDateTime dueDate;
private static final String line = "\t______________________________________________________";
private DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy HHmm");
private DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("MMM dd yyyy HHmm", Locale.ENGLISH);

/**
* Constructs a Deadline task with the specified description and due date.
*
* @param description The description of the deadline task.
* @param dueDate The due date of the deadline task in the format "dd/MM/yyyy HHmm".
*/
public Deadline(String description, String dueDate) {
super(description);
this.dueDate = LocalDateTime.parse(dueDate, inputFormat);
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/Task/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,24 @@
import java.time.format.DateTimeParseException;
import java.util.Locale;

/**
* Represents an event task in the task manager application.
* An event task has a description, start time, and end time.
*/
public class Event extends Task{
private LocalDateTime startTime;
private LocalDateTime endTime;
private static final String line = "\t______________________________________________________";
private DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy HHmm");
private DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("MMM dd yyyy HHmm", Locale.ENGLISH);

/**
* Constructs an Event task with the specified description, start time, and end time.
*
* @param description The description of the event task.
* @param startTime The start time of the event in the format "dd/MM/yyyy HHmm".
* @param endTime The end time of the event in the format "dd/MM/yyyy HHmm".
*/
public Event(String description, String startTime, String endTime) {
super(description);
this.startTime = LocalDateTime.parse(startTime, inputFormat);
Expand Down
24 changes: 21 additions & 3 deletions src/main/java/Task/Task.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
package task;

/**
* Represents a generic task in the task manager application.
* A task has a description and can be marked as done or undone.
*/
public class Task {
protected String description;
protected boolean isDone;
protected String type;

/**
* Constructs a Task with the specified description.
*
* @param description The description of the task.
*/
public Task(String description) {
this.description = description;
this.isDone = false;
}

/**
* Gets the status icon of the task.
* Returns "X" if the task is done, otherwise returns a space.
*
* @return The status icon of the task.
*/
public String getStatusIcon() {
return (isDone ? "X" : " "); // mark done task with X
}

/**
* Gets the description of the task.
*
* @return The description of the task.
*/
public String getDescription() {
return this.description;
}
public String getType() {
return "";
}

public String getTaskInfo() {
return this.description;
}
Expand Down

0 comments on commit 8a954d1

Please sign in to comment.