From d4aa5796042b268da85112925f063021c3f81b49 Mon Sep 17 00:00:00 2001
From: Ethan Robert <ethan.rbrt90@gmail.com>
Date: Fri, 28 Feb 2025 09:44:49 +0100
Subject: [PATCH] Added Task class

---
 src/tp03/Task.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 src/tp03/Task.java

diff --git a/src/tp03/Task.java b/src/tp03/Task.java
new file mode 100644
index 0000000..c8f2c47
--- /dev/null
+++ b/src/tp03/Task.java
@@ -0,0 +1,58 @@
+package tp03.ex02;
+
+import java.time.LocalDate;
+
+public class Task {
+	private int taskID;
+	private LocalDate creationDate;
+	private LocalDate deadline;
+	private TaskStatus status;
+	private String description;
+	private int duration;
+
+	private static int counter = 0;
+
+	public Task(String description, int duration) {
+		this.taskID = Task.counter;
+		Task.counter++;
+
+		this.creationDate = LocalDate.now();
+		this.deadline = this.creationDate.plusDays(10);
+
+		this.duration = duration;
+		this.description = description;
+
+		this.status = TaskStatus.TODO;
+
+	}
+
+	public Task(String description, LocalDate creation, LocalDate deadline, int duration) {
+		this.taskID = Task.counter=
+		Task.counter++;
+
+		this.creationDate = creation;
+		this.deadline = deadline;
+
+		this.duration = duration;
+		this.description = description;
+
+		this.status = TaskStatus.TODO;
+	}
+
+	public String toString() {
+		return "T" + this.taskID + " = " + this.description + ":" + this.status + "(" + this.duration + "):" + this.deadline;
+	}
+
+	public void changeStatus(TaskStatus st) {
+		this.status = st;
+	}
+
+	public void changeStatus() {
+		for (int i = 0; i < TaskStatus.values().length; i++) {
+			if (TaskStatus.values()[i].equals(this.status)) {
+				// Use modulo to avoid errors
+				this.status = TaskStatus.values()[i+1 % TaskStatus.values().length];
+			}
+		}
+	}
+}
\ No newline at end of file
-- 
GitLab