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

[Ryan Jee] iP #268

Open
wants to merge 193 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
3eff0e6
Add skeletal function of Duke
rjeez Feb 6, 2021
5c86aa2
Add ability to show list
rjeez Feb 6, 2021
ec54d44
Add Todo Tasktype
rjeez Feb 6, 2021
547f05b
Add Task class
rjeez Feb 6, 2021
cf149a2
Add Event tasktype
rjeez Feb 6, 2021
7759f9a
Add Deadline tasktype
rjeez Feb 6, 2021
56c85b2
Add DukeException class for exceptions specifically for Duke
rjeez Feb 6, 2021
6436423
Add Storage class to save tasks
rjeez Feb 6, 2021
f16618c
Add DukeLIst class to potentially store multiple list types
rjeez Feb 6, 2021
d531250
Create Command.java
rjeez Feb 6, 2021
ac57426
Add Main Class for GUI support
rjeez Feb 6, 2021
01cc9d6
Add MainWindow for GUI support
rjeez Feb 6, 2021
3441df1
Add DialogBox class for GUI support
rjeez Feb 6, 2021
a6b6963
Add Launcher class to launch applitcation
rjeez Feb 6, 2021
0aa6f50
Moved to gui folder
rjeez Feb 6, 2021
4098bb4
Moved to gui folder
rjeez Feb 6, 2021
87f89db
Moved to gui folder
rjeez Feb 6, 2021
3fd6a39
Moved to gui folder
rjeez Feb 6, 2021
7d8e968
Moved to gui folder
rjeez Feb 6, 2021
b840512
Moved to gui folder
rjeez Feb 6, 2021
e2bf38f
Moved to gui folder
rjeez Feb 6, 2021
d504d49
Moved to gui folder
rjeez Feb 6, 2021
a2b182e
Added package
rjeez Feb 6, 2021
863e33e
Create CBye.java
rjeez Feb 22, 2021
b8850d1
Create CDeadline.java
rjeez Feb 22, 2021
7f28018
Create CDelete.java
rjeez Feb 22, 2021
422c8c2
Create CDone.java
rjeez Feb 22, 2021
ba66524
Create CEvent.java
rjeez Feb 22, 2021
143a739
Create CList.java
rjeez Feb 22, 2021
d835407
Create ICommand.java
rjeez Feb 22, 2021
b87cca8
Create DukeException.java
rjeez Feb 22, 2021
9a5bfc3
Create DukeList.java
rjeez Feb 22, 2021
2a6fc6d
Create DialogBox.java
rjeez Feb 22, 2021
c5f83fe
Create CFind.java
rjeez Feb 22, 2021
39fc04d
Create CTodo.java
rjeez Feb 22, 2021
d8ed206
Create Storage.java
rjeez Feb 22, 2021
10cefb8
Create Deadline.java
rjeez Feb 22, 2021
abc6c1e
Create Event.java
rjeez Feb 22, 2021
3915318
Create Parser.java
rjeez Feb 22, 2021
755ab2a
Create Task.java
rjeez Feb 22, 2021
d7778ee
Create Todo.java
rjeez Feb 22, 2021
8408de4
Create Ui.java
rjeez Feb 22, 2021
1a5f1d7
Create Main.java
rjeez Feb 22, 2021
98c7115
Create Launcher.java
rjeez Feb 22, 2021
555468a
Create MainWindow.java
rjeez Feb 22, 2021
65a60a0
Create Duke.java
rjeez Feb 22, 2021
23ef9c9
Create vcs.xml
rjeez Feb 22, 2021
2a3aed8
Create .gitignore
rjeez Feb 22, 2021
97b08ed
Create misc.xml
rjeez Feb 22, 2021
a4d534c
Create modules.xml
rjeez Feb 22, 2021
849c049
Delete Command.java
rjeez Feb 22, 2021
5f30f79
Delete Duke.java
rjeez Feb 22, 2021
bf9699a
Delete DukeException.java
rjeez Feb 22, 2021
b8a111e
Delete DukeList.java
rjeez Feb 22, 2021
6012491
Delete DialogBox.java
rjeez Feb 22, 2021
45825ec
Delete Storage.java
rjeez Feb 22, 2021
fd3ae73
Delete Launcher.java
rjeez Feb 22, 2021
d29d4c1
Delete Deadline.java
rjeez Feb 22, 2021
d12e4b9
Delete Event.java
rjeez Feb 22, 2021
7a1e991
Delete Todo.java
rjeez Feb 22, 2021
cf05170
Delete Main.java
rjeez Feb 22, 2021
051cbcd
Delete MainWindow.java
rjeez Feb 22, 2021
e5faea7
Delete Task.java
rjeez Feb 22, 2021
58bdb2f
Delete Ui.java
rjeez Feb 22, 2021
eb4cc5e
Create Main1.java
rjeez Feb 22, 2021
57e46ab
Update Main.java
rjeez Feb 22, 2021
5141b2f
Create Launcher.java
rjeez Feb 22, 2021
f33b1eb
Delete Launcher.java
rjeez Feb 22, 2021
36aeb2c
Delete Main.java
rjeez Feb 22, 2021
169e64a
Create build.gradle
rjeez Feb 23, 2021
c29ae19
Create gradlew.bat
rjeez Feb 23, 2021
eb5f818
Create gradlew
rjeez Feb 23, 2021
2fe3b28
Create gradle-wrapper.properties
rjeez Feb 23, 2021
4b2c886
Create gradle-wrapper.jar
rjeez Feb 23, 2021
c064d54
Update Storage.java
rjeez Feb 23, 2021
a7ce31b
Update Parser.java
rjeez Feb 23, 2021
648a0c8
Update CList.java
rjeez Feb 23, 2021
eb7a203
Create Bot.jpg
rjeez Feb 23, 2021
c4dbbad
Create User.jpg
rjeez Feb 23, 2021
49526fe
Create MainWindow.fxml
rjeez Feb 23, 2021
a0ef7ac
Create DialogBox.fxml
rjeez Feb 23, 2021
b489945
Delete vcs.xml
rjeez Feb 23, 2021
f2387c6
Delete modules.xml
rjeez Feb 23, 2021
9cdb6a0
Delete misc.xml
rjeez Feb 23, 2021
b69f01b
Delete .gitignore
rjeez Feb 23, 2021
b5a5065
Create gradle-wrapper.jar
rjeez Feb 23, 2021
1156199
Create CBye.java
rjeez Feb 23, 2021
8756858
Create CDeadline.java
rjeez Feb 23, 2021
6aad947
Create CDelete.java
rjeez Feb 23, 2021
e3b5c8b
Create CDone.java
rjeez Feb 23, 2021
93a1ca2
Create CDue.java
rjeez Feb 23, 2021
31d8850
Create CEvent.java
rjeez Feb 23, 2021
5a0c950
Create CFind.java
rjeez Feb 23, 2021
c203bb4
Create CList.java
rjeez Feb 23, 2021
8349f95
Create CTodo.java
rjeez Feb 23, 2021
c47e6d4
Create ICommand.java
rjeez Feb 23, 2021
39a7210
Create Duke.java
rjeez Feb 23, 2021
a692afd
Delete CBye.java
rjeez Feb 23, 2021
9aa9e90
Delete CDeadline.java
rjeez Feb 23, 2021
d9e64d1
Create gradle-wrapper.properties
rjeez Feb 23, 2021
7fb2fa8
Delete CDone.java
rjeez Feb 23, 2021
b56d62f
Delete CDelete.java
rjeez Feb 23, 2021
7f5a2a6
Delete CEvent.java
rjeez Feb 23, 2021
495f432
Delete CFind.java
rjeez Feb 23, 2021
118f4ae
Delete CList.java
rjeez Feb 23, 2021
9a54a07
Delete Duke.java
rjeez Feb 23, 2021
8da1bee
Delete ICommand.java
rjeez Feb 23, 2021
83cca67
Delete DukeException.java
rjeez Feb 23, 2021
25b32ce
Delete CTodo.java
rjeez Feb 23, 2021
3cbcc61
Delete DukeList.java
rjeez Feb 23, 2021
b2aeeb5
Delete DialogBox.java
rjeez Feb 23, 2021
9f8213d
Delete Launcher.java
rjeez Feb 23, 2021
ecf95c1
Delete Main.java
rjeez Feb 23, 2021
63bbe1d
Delete MainWindow.java
rjeez Feb 23, 2021
f079d43
Delete Parser.java
rjeez Feb 23, 2021
483cde5
Delete Storage.java
rjeez Feb 23, 2021
b8e7697
Delete Deadline.java
rjeez Feb 23, 2021
72951de
Delete Event.java
rjeez Feb 23, 2021
78ee103
Delete Task.java
rjeez Feb 23, 2021
c1109b5
Delete Ui.java
rjeez Feb 23, 2021
ac94bbe
Delete Todo.java
rjeez Feb 23, 2021
5eb4386
Create DukeException.java
rjeez Feb 23, 2021
b18c912
Create DukeList.java
rjeez Feb 23, 2021
4ddf0b7
Create DialogBox.java
rjeez Feb 23, 2021
66ffb11
Create Launcher.java
rjeez Feb 23, 2021
ba2d598
Create Launcher2.java
rjeez Feb 23, 2021
b250a17
Create Main.java
rjeez Feb 23, 2021
e2fe5a1
Create MainWindow.java
rjeez Feb 23, 2021
87e7f6b
Create Parser.java
rjeez Feb 23, 2021
29e7142
Create Storage.java
rjeez Feb 23, 2021
c1bb749
Create Deadline.java
rjeez Feb 23, 2021
719cc69
Create Task.java
rjeez Feb 23, 2021
5d7692a
Create Event.java
rjeez Feb 23, 2021
f48fa6d
Create Todo.java
rjeez Feb 23, 2021
498c1d6
Create Ui.java
rjeez Feb 23, 2021
4d79237
Delete Bot.jpg
rjeez Feb 23, 2021
493921f
Delete User.jpg
rjeez Feb 23, 2021
9201104
Delete DialogBox.fxml
rjeez Feb 23, 2021
f65e8d0
Delete MainWindow.fxml
rjeez Feb 23, 2021
bcfbaea
Create DialogBox.fxml
rjeez Feb 23, 2021
3e769f2
Create User.jpg
rjeez Feb 23, 2021
4e0112b
Create Bot.jpg
rjeez Feb 23, 2021
6db33ca
Create MainWindow.fxml
rjeez Feb 23, 2021
c059910
Update build.gradle
rjeez Feb 23, 2021
b0a61cc
Create duke.txt
rjeez Feb 23, 2021
b23f294
Create Help.PNG
rjeez Feb 23, 2021
d369a07
Update README.md
rjeez Feb 23, 2021
e1a6979
Create Ui.PNG
rjeez Feb 23, 2021
bdc98ad
Delete gradle-wrapper.jar
rjeez Feb 23, 2021
165bba4
Delete gradle-wrapper.properties
rjeez Feb 23, 2021
6391b95
Update gradle-wrapper.properties
rjeez Feb 23, 2021
e5124f2
Update CBye.java
rjeez Feb 23, 2021
7e9c75c
Update CDeadline.java
rjeez Feb 23, 2021
ff26236
Update CDelete.java
rjeez Feb 23, 2021
05f4e38
Update CDone.java
rjeez Feb 23, 2021
5438274
Delete CDue.java
rjeez Feb 23, 2021
14108f7
Update CEvent.java
rjeez Feb 23, 2021
06d4a0c
Update CFind.java
rjeez Feb 23, 2021
c9babe0
Create CHelp.java
rjeez Feb 23, 2021
c604ebb
Update CList.java
rjeez Feb 23, 2021
73a662d
Update CTodo.java
rjeez Feb 23, 2021
038e398
Update ICommand.java
rjeez Feb 23, 2021
ad92a54
Update Duke.java
rjeez Feb 23, 2021
5bc3889
Update DukeException.java
rjeez Feb 23, 2021
a3d5181
Update DukeList.java
rjeez Feb 23, 2021
22c5998
Update DialogBox.java
rjeez Feb 23, 2021
1f1fb24
Update Launcher.java
rjeez Feb 23, 2021
25340b7
Delete Launcher2.java
rjeez Feb 23, 2021
b2a1c33
Update Main.java
rjeez Feb 23, 2021
d659477
Update MainWindow.java
rjeez Feb 23, 2021
2b4603b
Update Parser.java
rjeez Feb 23, 2021
4f5426e
Update Storage.java
rjeez Feb 23, 2021
03d1af8
Update Deadline.java
rjeez Feb 23, 2021
83d488e
Update Event.java
rjeez Feb 23, 2021
b7e33f3
Update Task.java
rjeez Feb 23, 2021
8cb4d02
Update Todo.java
rjeez Feb 23, 2021
51908fa
Update Ui.java
rjeez Feb 23, 2021
fd6f680
Delete Bot.jpg
rjeez Feb 23, 2021
5fadee5
Create Bot.png
rjeez Feb 23, 2021
6b71f4e
Delete User.jpg
rjeez Feb 23, 2021
55e5ba0
Create User.png
rjeez Feb 23, 2021
1b5c762
Update MainWindow.fxml
rjeez Feb 23, 2021
e2e6565
Update EXPECTED.TXT
rjeez Feb 23, 2021
15e08dd
Update input.txt
rjeez Feb 23, 2021
0ae4202
Update README.md
rjeez Feb 23, 2021
dd20c32
Set theme jekyll-theme-time-machine
rjeez Feb 27, 2021
c3c8842
Update build.gradle
rjeez Feb 27, 2021
94504f7
Update EXPECTED.TXT
rjeez Feb 27, 2021
53ddf2b
Update input.txt
rjeez Feb 27, 2021
ff5c777
Merge branch 'master' of https://github.com/rjeez/ip
rjeez Feb 27, 2021
df1f842
Delete Ui.PNG
rjeez Mar 1, 2021
baa1c36
Create Ui.png.PNG
rjeez Mar 1, 2021
756f21f
Add JUnit testing
rjeez Mar 15, 2021
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
5 changes: 5 additions & 0 deletions src/main/java/Command.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package duke.command;

public class Command {

}
34 changes: 27 additions & 7 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
package duke;

import java.util.Scanner;

public class Duke {
public static void main(String[] args) {
String logo = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
private Storage storage;
private DukeList DukeList;
private Ui ui;


public Duke(String filePath){
ui = new Ui();

Choose a reason for hiding this comment

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

Might want to consider removing extra space(s) between new Ui()

storage = new Storage(filePath);
TaskList = storage.readFile();
}

public String getReply (String input){
Parser parser = new Parser();
try{
Command command = parser.parse(input);
String reply = command.execute(ui,taskList, storage);
storage.writeFile();
assert(reply!=null);

Choose a reason for hiding this comment

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

Good use of assertions!

return reply;
}
catch (DukeException e){
return e.getMessage();
}
}
}
7 changes: 7 additions & 0 deletions src/main/java/DukeException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package duke;

public class DukeException extends Exception{
public DukeException (String message){
super(message);
}
}
21 changes: 21 additions & 0 deletions src/main/java/DukeList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package duke;

import java.util.ArrayList;
import java.util.List;

public class DukeList {
private List<Task> taskList;

public DukeList(){
taskList = new ArrayList<>();
}

public DukeList(List<Task> taskList){
this.taskList = taskList;
}

public List<Task> getTaskList(){
return taskList;
}

}
60 changes: 60 additions & 0 deletions src/main/java/Storage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package duke;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

import duke.DukeException;;
import duke.DukeList;
import duke.tasktype.Task;
import duke.tasktype.Deadline;
import duke.tasktype.Event;
import duke.tasktype.Todo;

public class Storage {
private StringBuffer stringBufferOfTasks = new StringBuffer();
private String filename;
private Path path;

public Storage (String filename){
this.filename = new File(filename);
accessTaskListInFileSystem(getCurrentDirectory());

Choose a reason for hiding this comment

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

Clear and concise naming of method

}
private void taskListinFile (String current){
String[] parents = filename.split("/");
String parent = parents[0];
Path direcPath = Path(current,parent);
Path filePath = Path(current,filename);
boolean directoryExist = Files.exists(direcPath);
boolean fileExist = Files.exists(filePath);
try{

Choose a reason for hiding this comment

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

Might want to include spacing in between try {

if(!directoryExist){
Files.createDirectories(direcPath);
}
if(!fileExist){
Files.createFile(filePath);
}
}
catch(IOException e){
System.out.println(e.getMessage());
}
}

public DukeList load(){
DukeList dukeList = new DukeList();
StringBufferTasks = new StringBuffer();
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(new DataInputStream(new FileInputStream(this.filename))));

Choose a reason for hiding this comment

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

Might have exceeded line limit

String line = reader.readline();
}
}
}
35 changes: 35 additions & 0 deletions src/main/java/Ui.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package duke;

public class Ui {
public String makeDone(String task){
assert(task!= null);
return String.format("Following task is marked done: \n" + task);
}

public String showTaskAdded(String task, List<Task> taskList){
assert(task != null && taskList != null);
return String.format( "Added the following task : \n" + "%s\n" + "You now have %d tasks in your list.\n", task, taskList.size());

Choose a reason for hiding this comment

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

Might have exceeded line limit

}

public String showTaskDeleted(String task, List<Task> taskList){
assert(task != null && taskList != null);
return String.format("The following task has been removed:\n " + "%s\n" + " You now have %d tasks in your list.\n", task, taskList.size());
}

public String showList(List<task> taskList){
assert(taskList != null);
int counter = 1;
Stringbuffer showList = new Stringbuffer();
showList.append(" These are the tasks in your list:\n");
for (Task task : taskList){
showList.append(" " + counter + ". " + task.getStatus() + "'n");
counter++;
}
return showList.toString;
}

public String sayGoodbye(){
return "Goodbye!";
}

}
54 changes: 54 additions & 0 deletions src/main/java/gui/DialogBox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package duke.gui;

import java.io.IOException;
import java.util.Collections;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.text.Text;

public class DialogBox extends HBox {
@FXML
private Text dialog;
@FXML
private ImageView displayPicture;

private DialogBox(String text, Image img){
try{
FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class.getResource("/view/DialogBox.fxml"));
fxmlLoader.setController(this);
fxmlLoader.setRoot(this);
fxmlLoader.load();
} catch (IOException e){
e.printStackTrace();
}

dialog.setText(text);
displayPicture.setImage(img);
}

private void flip(){
ObservableList<Node> tmp = FXCollections.observableArrayList(this.getChildren());
Collections.reverse(tmp);
getChildren().setAll(tmp);
setAlignment(Pos.TOP_LEFT);
}

public static DialogBox getUserDialog(String text, Image img) {
return new DialogBox(text, img);
}

public static DialogBox getBotDialog(String text, Image img) {
var db = new DialogBox(text, img);
db.flip();
return db;
}
}
9 changes: 9 additions & 0 deletions src/main/java/gui/Launcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package duke.gui;

import javafx.application.Application;

public class Launcher {
public static void main(String[] args){
Application.launch(Main.class,args);
}
}
18 changes: 18 additions & 0 deletions src/main/java/gui/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package duke.gui;
import javafx.application.Application;
import javafx.fml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scence.layout.AnchorPane;
import java.io.IOException;

public class Main extends Application{
private Duke duke = new Duke("data/duke.txt");
@Override
public void start(Stage stage){
MainWindow mainWindow = new MainWindow(duke);
Scene scene = new Scene(mainWindow);
stage.setScene(scene);
stage.show();
}
}
42 changes: 42 additions & 0 deletions src/main/java/gui/MainWindow.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package duke.gui;

import javafx.fml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Textfield;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Vbox;
import java.io.IOException;
import duke.Duke;
public class MainWindow extends AnchorPane {
@FXML
private ScrollPane scrollPane;
@FXML
private VBox dialogContainer;
@FXML
private TextField userInput;
@FXML
private Button sendButton;

private Duke duke;
private Image userImage = new Image(this.getClass().getResourceAsStream("/images.Count.jpg"));
private Image botImage = new Image(this.getClass().getResourceAsStream("/images.Duke.jpg"));
private final String startMessage = "Hi there.\n"
+ "These are the stuff you can say.\n"

public Mainwindow(){

}
public void initialize(){
this.scrollPane.vvalueProperty().bind(this,dialogContainer.heightProperty());
dialogContainer.getChildren().add(DialogBox.getDukeDialog(startMessage,botImage));
}
@FXML
private void handleUserInput(){
String input = userInput.getText();
String respone = duke.getResponse(input);
dialogContainer.getChildren().addAll(DialogBox.getUserDialog(input,userImage), DialogBox.getDukeDialog(response,botImage));
userInput.clear();
}
}
13 changes: 13 additions & 0 deletions src/main/java/tasktype/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package duke.tasktype;

public class Deadline extends Task {
public Deadline (String name){
super(name);
this.type = "D";
}

public Deadline(String name, String dateTime){
super(name,dateTime);
this.type = "D";
}
}
13 changes: 13 additions & 0 deletions src/main/java/tasktype/Event.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package duke.tasktype;

public class Event extends Task {
public Event(String name){
super(name);
this.type = "E";
}

public Event(String name, String dateTime){
super(name, dateTime);
this.type = "E";
}
}
43 changes: 43 additions & 0 deletions src/main/java/tasktype/Task.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package duke.tasktype;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Task {
protected String name;
protected boolean isDone;
protected String type;
protected LocalDateTime dateTime;

public Task(String name){
this.name = name;
this.isDone = false;
}

public Task(String name, Stirng dateTime){
this.name = name;
this.isDone = false;
this.dateTime = LocalDateTime.parse(dateTime, DateTimeFormatter.ofPattern("yyyy-MM-dd kkmm"));
}

public void setDone(){
isDone = true;
}

public String getName(){
return name;
}

public String getStatusIcon(){
return (isDone ? "✓" : "X");
}

public String getStatus(){
if(dateTime == null){
return " [" + type + "] " + " [" + getStatusIcon() + "] " + getname();
}
else{
return " [" + type + "] " + " [" + getStatusIcon() + "] " + getname() + " " + dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd kkmm"));

Choose a reason for hiding this comment

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

Might have exceeded line limit

}
}
}
8 changes: 8 additions & 0 deletions src/main/java/tasktype/Todo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package duke.tasktype;

public class Todo extends Task {
public Todo (String name){
super(name);
this.type = "T";
}
}