Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
b2b7d6d
Update gitignore to include class files and modified Chatbot name to V
KHsienKit Aug 19, 2024
723a279
Fix bug to include .class files in gitignore
KHsienKit Aug 19, 2024
d0d3e24
Make V echo commands
KHsienKit Aug 28, 2024
09aa704
Add list functionality to V
KHsienKit Aug 28, 2024
c7d834d
Add mark as done function to V
KHsienKit Aug 28, 2024
ebb8b59
Clean up code to fit coding standards
KHsienKit Aug 28, 2024
00b8cea
Change if else statements to switch case
KHsienKit Sep 3, 2024
2d82f1e
Add .vscode folder to gitignore
KHsienKit Sep 3, 2024
0246d23
Add tracking ToDos, Events and Deadlines
KHsienKit Sep 3, 2024
75b5bd8
Change starting programme from V.java to Main.java
KHsienKit Sep 4, 2024
86d78e8
Shift deadline case statement above event
KHsienKit Sep 4, 2024
9031dda
Clean up code to meet quality standards
KHsienKit Sep 6, 2024
1ffa5f8
Add exception to mark and deadline function
KHsienKit Sep 10, 2024
c06df2b
Merge branch 'branch-Level-5'
KHsienKit Sep 10, 2024
f75d553
Add comment line to trigger new commit for new tag
KHsienKit Sep 16, 2024
c068a61
Use ArrayList<Task> to keep track list of tasks
KHsienKit Sep 16, 2024
c6c5306
Automate text ui testing
KHsienKit Sep 16, 2024
b4e6a56
Clean up unwanted comments
KHsienKit Sep 16, 2024
e6a1340
Add support for deleting tasks from the list
KHsienKit Sep 16, 2024
055c395
Remove comment line from previous commit
KHsienKit Sep 16, 2024
2c1f70c
Remove comment line to add A-Exceptions tag
KHsienKit Sep 16, 2024
c266c3d
Add getType() method for all child class of Task
KHsienKit Sep 16, 2024
6082be0
Add V.txt to .gitignore
KHsienKit Sep 17, 2024
3c52351
Add getter functions for Task and its subclasses
KHsienKit Sep 17, 2024
2da60a6
Change file run and compilation name to Main
KHsienKit Sep 17, 2024
5bdc397
Add save functionality
KHsienKit Sep 17, 2024
a895954
Merge branch 'branch-Level-6'
KHsienKit Sep 17, 2024
95dee0d
Merge branch 'branch-Level-7'
KHsienKit Sep 17, 2024
662f20c
Fix bugs from merge with branch-Level-7
KHsienKit Sep 17, 2024
df3683b
Add META-INF folder and .jar file to gitignore
KHsienKit Sep 17, 2024
4a6cba1
Fix loadSaveFile bug
KHsienKit Sep 17, 2024
ef199ed
Fix delete task bug
KHsienKit Sep 18, 2024
6d08b64
Add compile script
KHsienKit Sep 18, 2024
62581e7
Create folder to hold compile script and files
KHsienKit Sep 24, 2024
8cb3432
Move compile.bat file out of folder
KHsienKit Sep 24, 2024
1399fca
Create txt file to hold path of all .java files
KHsienKit Sep 24, 2024
3f173eb
Add META-INF folder to class-files folder
KHsienKit Sep 24, 2024
c660431
Remove sources.txt file
KHsienKit Sep 24, 2024
a08c526
Implement .bat file to compile and make jar file
KHsienKit Sep 24, 2024
c17532b
Fix bug where class files were added to a folder
KHsienKit Sep 24, 2024
67a3381
Initialise Storage Class
KHsienKit Sep 24, 2024
af3bf76
Add saveFilePath parameter to Storage class method
KHsienKit Sep 24, 2024
637b76f
Initiliase Parser class
KHsienKit Sep 24, 2024
48a3c21
Initiliase TaskList class
KHsienKit Sep 24, 2024
1a5e9aa
Initiliase Ui class
KHsienKit Sep 24, 2024
3d73a2e
Add command to delete save file of previous run
KHsienKit Sep 24, 2024
69b6240
Extract out TaskList class
KHsienKit Sep 24, 2024
647b93c
Fix empty list display bug
KHsienKit Sep 24, 2024
2d63e0d
Extract storage class
KHsienKit Sep 24, 2024
89bc0e2
Fix bug where V print to terminal during load save
KHsienKit Sep 24, 2024
aeb1168
Extract clearSaveFile method
KHsienKit Sep 25, 2024
40f5a8a
Reorganise code in Storage.java for clearer read
KHsienKit Sep 25, 2024
cefcaec
Add constructor for Storage with filepath
KHsienKit Sep 25, 2024
f26bf00
Add Parser class
KHsienKit Sep 25, 2024
b65b3f0
Add Ui class
KHsienKit Sep 25, 2024
340cc71
Add parser to TaskList when loading save file
KHsienKit Sep 25, 2024
85f6afe
Add find command for parser
KHsienKit Sep 25, 2024
f55e8a3
Add print line seperator function to Ui class
KHsienKit Sep 25, 2024
d60cf51
Add find function to TaskList
KHsienKit Sep 25, 2024
59e642b
Add JavaDoc to all classes and functions
KHsienKit Sep 25, 2024
400c849
Merge pull request #1 from KHsienKit/branch-Level-9
KHsienKit Sep 25, 2024
f35b164
Merge branch 'master' into branch-A-JavaDoc
KHsienKit Sep 25, 2024
c9ae249
Merge pull request #2 from KHsienKit/branch-A-JavaDoc
KHsienKit Sep 25, 2024
1899673
Add case insensitive search for find function
KHsienKit Sep 26, 2024
2056c41
Add user guide
KHsienKit Sep 26, 2024
2f42622
Add approriate line breaks to README
KHsienKit Sep 26, 2024
3682108
Add whitespace for intro
KHsienKit Sep 26, 2024
467778d
Fix typo in README
KHsienKit Sep 26, 2024
5e3db0f
Add cutoff line at the bottom of README
KHsienKit Sep 26, 2024
7584b2f
Remove "##" from bottom of README
KHsienKit Sep 26, 2024
a9ce511
Add error handling for add event, mark and delete
KHsienKit Sep 26, 2024
715514a
Extract printing of error message to Ui class
KHsienKit Sep 26, 2024
6777b16
Add link to final release to README
KHsienKit Sep 26, 2024
8f57a0a
Fix README error on save file location
KHsienKit Sep 26, 2024
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#.vscode Folder
/.vscode

# Class files
*.class

# IDEA files
/.idea/
/out/
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
public class Deadline extends Task {
private final String TYPE = "D";
private String by;
Comment on lines +11 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider declaring attributes as protected rather than private as it would be easier to facilitate extension of subclasses as the project progress.


public Deadline(String description, String by) {
super(description);
this.by = by;
}

@Override
public String getType() {
return TYPE;
}

@Override
public String toString() {
return super.toString() + " (by: " + this.by + ")";
}
}
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

25 changes: 25 additions & 0 deletions src/main/java/Event.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
public class Event extends Task {
private final String TYPE = "E";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good use of declaring a constant to determine the type of task when returning from the getType method!

private String from;
private String to;

public Event(String description, String from, String to) {
super(description);
this.from = from;
this.to = to;
}

public String getfrom() {
return this.from;
}

@Override
public String getType() {
return TYPE;
}

@Override
public String toString() {
return super.toString() + String.format(" (from: %s to: %s)", from, to);
}
}
31 changes: 31 additions & 0 deletions src/main/java/Task.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
public class Task {
protected String description;
protected boolean isDone;

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

// Tasks that are done are marked with an X
public String getStatus() {
return (isDone ? "X" : " ");
}

public String getDescription() {
return this.description;
}

public String getType() {
return null;
}

public void setDone() {
this.isDone = true;
}

@Override
public String toString() {
return String.format("[%s] %s", getStatus(), this.description);
}
}
12 changes: 12 additions & 0 deletions src/main/java/ToDo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public class ToDo extends Task {
private final String TYPE = "T";

public ToDo(String description) {
super(description);
}

@Override
public String getType() {
return TYPE;
}
}
96 changes: 96 additions & 0 deletions src/main/java/V.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import java.util.Scanner;
import java.util.Arrays;

public class V {

private static final String LINE_SEPERATOR = "____________________________________________________________";

// Print 2 line seperators between a block of text for cleaner CLI
public static void printBlock(String text) {
System.out.println(LINE_SEPERATOR);
System.out.println(text);
System.out.println(LINE_SEPERATOR);
}

public static void greet() {
String logo = " _ _ \n"
+ "\\ \\ / / \n"
+ " \\ \\ / / \n"
+ " \\ \\_/ / \n"
+ " \\___/ \n";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider to declare as public static final

System.out.print(logo);
printBlock("Hi I'm V\nWhat can I do for you?");
}

public static void displayList(Task[] listOfTasks, int length) {
System.out.println(LINE_SEPERATOR);
for (int i = 0; i < length; i++) {
System.out.println(String.format("%d.[%s]%s", i + 1,
listOfTasks[i].getType(), listOfTasks[i]));
}
System.out.println(LINE_SEPERATOR);
}

public static void main(String[] args) {
greet();

boolean isOnline = true;
Task[] listOfTasks = new Task[100];
int count = 0;
String temp;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

variable name "temp" can be more descriptive.

String description;
String by;
String[] timePeriod;
String from;
String to;
String line;
String[] lineArr;
Scanner input = new Scanner(System.in);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The respective variables here are hard to follow, maybe you could provide a comment for each of the variable's use case?


while (isOnline) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good naming convention for your boolean variable!

line = input.nextLine();
lineArr = line.trim().split(" ");
switch (lineArr[0]) {
case "bye":
input.close();
isOnline = false;
break;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good use of boolean flag isOnline as it allows the program to have a clear flow and makes the code easy to understand.

case "list":
displayList(listOfTasks, count);
break;
case "mark":
int position = Integer.parseInt(lineArr[1]);
listOfTasks[position - 1].setDone();
displayList(listOfTasks, count);
break;
case "todo":
description = String.join(" ", Arrays.copyOfRange(lineArr, 1, lineArr.length));
listOfTasks[count] = new ToDo(description);
count++;
break;
case "event":
temp = String.join(" ", Arrays.copyOfRange(lineArr, 1, lineArr.length));
description = temp.split("/from")[0];
timePeriod = temp.split("/from")[1].split("/to");
from = timePeriod[0];
to = timePeriod[1];
listOfTasks[count] = new Event(description, from, to);
System.out.println(listOfTasks[count]);
count++;
break;
case "deadline":
temp = String.join(" ", Arrays.copyOfRange(lineArr, 1, lineArr.length));
description = temp.split("/by")[0];
by = temp.split("/by")[1];
listOfTasks[count] = new Deadline(description, by);
System.out.println(listOfTasks[count]);
count++;
break;
default:
System.out.println("Try again");
break;
}
}
printBlock("See Ya");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could consider shortening your main method by breaking down the respective tasks into smaller methods

}