Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ab7d967
Changed bot name to Aragorn and implemented Echo for level 1
vimalapugazhan Feb 6, 2024
5c6c705
Completed Level 2
vimalapugazhan Feb 6, 2024
0eb2de1
Implemented basic functionality for level 3
vimalapugazhan Feb 7, 2024
e2343e0
Completed Level - 3 fully
vimalapugazhan Feb 7, 2024
b8381d7
Completed Level - 4.
vimalapugazhan Feb 8, 2024
8b4b87b
Added messages to stop double marking and unmarking
vimalapugazhan Feb 17, 2024
57b6d91
Added commandIdentifier method
vimalapugazhan Feb 17, 2024
ccd3da5
added input parser to split input to description and task conditions
vimalapugazhan Feb 17, 2024
715c55b
added /help command and changes to case statements for readablility
vimalapugazhan Feb 17, 2024
f0eae4a
prints empty list message
vimalapugazhan Feb 17, 2024
71994ee
Refactor inputParser and commandIdentifier into seperate class. Added…
vimalapugazhan Feb 18, 2024
5e83761
Merge branch 'branch-Level-5'
vimalapugazhan Feb 18, 2024
99799cb
Added packages
vimalapugazhan Feb 18, 2024
bfe0e6b
Added more exceptions for event task and formatted printing
vimalapugazhan Feb 18, 2024
95805b8
Merge branch 'branch-A-Packages'
vimalapugazhan Feb 18, 2024
5ae1ba1
Implemented ArrayList instead of Array of tasks
vimalapugazhan Feb 21, 2024
1883fae
Added delete function and removed commented code
vimalapugazhan Feb 21, 2024
bb9cd02
Level - 7
vimalapugazhan Feb 21, 2024
b699596
Merge branch 'branch-Level-6'
vimalapugazhan Feb 21, 2024
8a24c8d
Merge branch 'branch-Level-7'
vimalapugazhan Feb 21, 2024
a5baff9
removed unnecessary throw
vimalapugazhan Feb 21, 2024
afaa95b
achieved A-Jar
vimalapugazhan Feb 21, 2024
8fd188b
fixed file path and directory creation
vimalapugazhan Feb 23, 2024
69ce325
Remove additional white space bug for todo type tasks
vimalapugazhan Feb 23, 2024
293f494
Refactor decision making code from main
vimalapugazhan Feb 27, 2024
b0f1acc
Replace magic string in main
vimalapugazhan Feb 27, 2024
b47a8a7
Remove most magic string. Refactor code.
vimalapugazhan Feb 27, 2024
7d25560
Merge branch 'MoreOOP'
vimalapugazhan Feb 27, 2024
92e02c7
Fix file visibility
vimalapugazhan Feb 27, 2024
8a35d1f
Fix Spacing
vimalapugazhan Feb 27, 2024
2b44a52
Implement Find Task command
vimalapugazhan Feb 27, 2024
f82932b
Merge branch 'branch-Level-9'
vimalapugazhan Feb 27, 2024
78ff600
Revert "Implement Find Task command"
vimalapugazhan Feb 27, 2024
0c91c3a
no message
vimalapugazhan Feb 27, 2024
a0889ec
complete level-7
vimalapugazhan Feb 27, 2024
9a357a8
Merge pull request #1 from vimalapugazhan/branch-Level-9
vimalapugazhan Feb 27, 2024
2b37913
Modify command list and replace magic string
vimalapugazhan Feb 27, 2024
3e38bc3
Refactor Parser methods
vimalapugazhan Feb 29, 2024
976252d
change package name and imports
vimalapugazhan Feb 29, 2024
1fbd29e
Combine case statements for DELETE and UNMARK commands
vimalapugazhan Feb 29, 2024
f7cf060
Write documentations for some methods
vimalapugazhan Mar 5, 2024
d60df8f
Add additional documentation
vimalapugazhan Mar 7, 2024
0536bf5
Merge pull request #2 from vimalapugazhan/branch-A-JavaDoc
vimalapugazhan Mar 7, 2024
c73af7b
Complete User guide
vimalapugazhan Mar 7, 2024
726b533
Merge branch 'branch-A-JavaDoc'
vimalapugazhan Mar 7, 2024
744f5d9
Merge branch 'master' of https://github.com/vimalapugazhan/ip
vimalapugazhan Mar 7, 2024
c143f9e
Update README.md
vimalapugazhan Mar 7, 2024
c6dd136
Update README.md 2
vimalapugazhan Mar 7, 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
58 changes: 58 additions & 0 deletions src/main/java/Aragorn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import java.util.Scanner;

Choose a reason for hiding this comment

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

Import was explicitly listed


public class Aragorn {

public static void main(String[] args) {
String LINE = " __________________________________________________________\n";
String GREET = " Hello! I am Aragorn son of Arathorn, and am called Elessar, the Elfstone, Dúnadan,\n" +
" the heir of Isildur Elendil's son of Gondor.\n" +
" What can I do for you?\n";
String EXIT = " Bye. Hope to see you again soon!\n";
String TAB = " ";
Task[] list = new Task[100];

Choose a reason for hiding this comment

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

can consider making the length of the task array a variable

int listLength = 0;
System.out.println(LINE + GREET + LINE);
int index;
String echo;
Scanner in = new Scanner(System.in);
while(true) {
String userInput = in.nextLine();

if (userInput.equals("bye")) {
System.out.println(LINE + TAB + EXIT + LINE);

Choose a reason for hiding this comment

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

consider using multiple print statements to make the code more readable

return;
}

if (userInput.equals("list")) {

Choose a reason for hiding this comment

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

Consider refactoring the code to reduce the length in void main

System.out.println(LINE);
System.out.println("Here are the tasks in your list: ");
for (int i = 0; i < listLength; i += 1) {
System.out.println(TAB + "[" + list[i].getStatusIcon() + "] " + (i + 1) + ". " + list[i].getDescription());
}
System.out.println(LINE);
continue;
}

if (userInput.contains("unmark")) {
index = Integer.parseInt(userInput.substring(7)) - 1;
list[index].markAsUndone();
System.out.println(LINE + TAB + "OK, I've marked this task as not done yet:\n" + TAB +
" [ ] " + list[index].getDescription() +"\n" + LINE);
continue;
}

else if (userInput.contains("mark")) {

Choose a reason for hiding this comment

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

else if should be placed on the same line as on 42

index = Integer.parseInt(userInput.substring(5)) - 1;
list[index].markAsDone();
System.out.println(LINE + TAB + "Nice! I've marked this task as done:\n" + TAB +
" [X] " + list[index].getDescription() +"\n" + LINE);

Choose a reason for hiding this comment

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

Missing a space between + and "\n"

continue;
}

list[listLength] = new Task(userInput);
listLength += 1;
echo = userInput;
System.out.println(LINE + TAB + "added: " + echo + "\n" + LINE);
}
}
}
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

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;
}

public String getStatusIcon() {
return (isDone ? "X" : " "); // mark done task with X

Choose a reason for hiding this comment

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

ideal to refer to all instance parameters with the this keyword, e.g. this.isDone

Choose a reason for hiding this comment

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

good use of ternary statements, though brackets are not needed to evaluate them

}

public void markAsDone() {
this.setDone(true);
}

public void markAsUndone() {
this.setDone(false);
}

public String getDescription() {
return description;
}

public void setDone(boolean done) {
isDone = done;
}

}