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

[janelleenqi] iP #75

Open
wants to merge 85 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
a4564e4
rename "Duke" to "Luke", and added greetings
janelleenqi Sep 4, 2023
860d878
add echo feature
janelleenqi Sep 4, 2023
35b72fc
add features (add, list but reverse)
janelleenqi Sep 5, 2023
5fc8ba6
amend features (add, list)
janelleenqi Sep 5, 2023
8e02823
add feature (mark as done)
janelleenqi Sep 5, 2023
6b19f57
tweaks to follow naming conventions
janelleenqi Sep 5, 2023
aebc096
Added three different task types (ToDos, Events, Deadlines)
janelleenqi Sep 7, 2023
17570b2
Added three different task types (ToDos, Events, Deadlines)
janelleenqi Sep 7, 2023
10bcaae
Added three different task types (ToDos, Events, Deadlines)
janelleenqi Sep 7, 2023
b503333
Added three different task types (ToDos, Events, Deadlines)
janelleenqi Sep 7, 2023
5bae015
Added Text-UI-Testing
janelleenqi Sep 7, 2023
2702b6e
Revise formatting, Implement enum & switch
janelleenqi Sep 10, 2023
7796691
make Task an abstract task
janelleenqi Sep 17, 2023
39b457c
fix lines spaced part 2
janelleenqi Sep 17, 2023
573e246
fix lines spaced part 2
janelleenqi Sep 17, 2023
bf1f72b
remove unnecessary line
janelleenqi Sep 19, 2023
7087e36
IntelliJ recommendations
janelleenqi Sep 19, 2023
0609792
add some try-catch blocks
janelleenqi Sep 19, 2023
e41f732
add some try-catch blocks and throw-catch blocks
janelleenqi Sep 20, 2023
6c7aeb7
add try-catch blocks and throw-catch blocks for random words
janelleenqi Sep 20, 2023
4320721
change to more specific error message lines
janelleenqi Sep 20, 2023
f6e4a2d
change to even more specific error message lines and fix list error
janelleenqi Sep 20, 2023
5dc30d9
throw error if deadline format is wrong
janelleenqi Sep 20, 2023
e0a2e01
throw error if event format is wrong
janelleenqi Sep 20, 2023
3eb76bc
Merge branch 'branch-Level-5'
janelleenqi Sep 20, 2023
25200f0
divide classes into packages
janelleenqi Sep 20, 2023
746312f
fix lines
janelleenqi Sep 20, 2023
37b5bb1
Merge branch 'branch-A-packages'
janelleenqi Sep 20, 2023
ed9f860
use java collection classes, add "delete" action
janelleenqi Sep 21, 2023
022d97d
(notes: errors exist) adding memory storage using txt file
janelleenqi Sep 21, 2023
e51e000
ignore META-INF folder
janelleenqi Sep 21, 2023
36fcba8
write new memory into memory.txt, ignore META-INF folder
janelleenqi Sep 21, 2023
0641727
ignore META-INF folder
janelleenqi Sep 21, 2023
af7f54c
(still needs fixing) add read ability from existing file
janelleenqi Sep 21, 2023
0437cfb
(still needs fixing) able to read from file and write to file but una…
janelleenqi Sep 21, 2023
6494a32
.gitignore for memory.txt
janelleenqi Sep 21, 2023
52f898d
Merge branch 'branch-Level-6'
janelleenqi Sep 21, 2023
39ad792
resolved conflicts (same errors of can read, can write, but cannot us…
janelleenqi Sep 21, 2023
652c9b2
can use file data
janelleenqi Sep 21, 2023
51f7a9f
fix indentation
janelleenqi Oct 4, 2023
4bcd01d
fix indentation
janelleenqi Oct 4, 2023
801ed78
Add "find" ActionType
janelleenqi Oct 4, 2023
39eda3c
Add Objects (Ui & Parser)
janelleenqi Oct 5, 2023
18a6643
Add Objects (ExitCommand)
janelleenqi Oct 5, 2023
bf62341
Add Objects (DeleteCommand)
janelleenqi Oct 5, 2023
56321ce
Add Objects (ListCommand)
janelleenqi Oct 5, 2023
48815a3
Add Objects (FindCommand)
janelleenqi Oct 5, 2023
ef5a710
make more OOP but with errors
janelleenqi Oct 5, 2023
2da6307
Add Objects (MarkCommand)
janelleenqi Oct 5, 2023
49d2924
Fix Objects (Parser), to include instantiating child classes of Command
janelleenqi Oct 5, 2023
772d5cf
Add Objects (AddCommand)
janelleenqi Oct 5, 2023
f1b66a6
Add Abstract Class (Command)
janelleenqi Oct 5, 2023
364d48d
Fix Objects (Parser)
janelleenqi Oct 5, 2023
ad80c66
Add Objects (Storage)
janelleenqi Oct 5, 2023
1818f2f
Add Objects (TaskList)
janelleenqi Oct 5, 2023
3190778
Fix Objects (Ui)
janelleenqi Oct 5, 2023
b99923f
Fix Luke to get a code that can run
janelleenqi Oct 5, 2023
1109f04
Add "BYE" to ActionType, Add "BYE" case to Parser parse method, so th…
janelleenqi Oct 5, 2023
3ad68bf
Fix small errors
janelleenqi Oct 5, 2023
de661a4
Fix - "bye" ends Luke without scanner errors
janelleenqi Oct 5, 2023
a466466
Fix Retrieval of Memory (syntax)
janelleenqi Oct 5, 2023
4342a65
Print correct and specific error messages for errors
janelleenqi Oct 5, 2023
698d964
Fix spacing in memory storage/retrieval
janelleenqi Oct 5, 2023
41f428d
Code Organisation
janelleenqi Oct 5, 2023
3d28a78
Merge branch 'branch-A-MoreOOP'
janelleenqi Oct 5, 2023
b8fe251
Add JavaDoc comments
janelleenqi Oct 5, 2023
54c9b4c
Fix Level-9
janelleenqi Oct 5, 2023
afa9433
Merge pull request #1 from janelleenqi/branch-Level-9
janelleenqi Oct 5, 2023
3d45534
Merge branch 'master' into branch-A-JavaDoc
janelleenqi Oct 5, 2023
1845d33
Merge pull request #2 from janelleenqi/branch-A-JavaDoc
janelleenqi Oct 5, 2023
56970bd
Update docs\README.md
janelleenqi Oct 5, 2023
688c7da
Update docs\README.md part 2
janelleenqi Oct 5, 2023
3ed4739
Update docs\README.md part 3
janelleenqi Oct 6, 2023
a1a0256
Update docs\README.md part 4
janelleenqi Oct 6, 2023
f21791f
Update Level 7 Save: Luke runs even if no memory.txt exists
janelleenqi Oct 6, 2023
e1e19fb
Update Level 7 Save: Luke runs even if no memory.txt exists part 2
janelleenqi Oct 6, 2023
5c566bd
Update Level 7 Save: directory "data" is created and file "memory.txt…
janelleenqi Oct 6, 2023
2e094bf
Rename LukeTimeError to LukeException
janelleenqi Oct 6, 2023
4e9d393
Refine error from invalid user input
janelleenqi Oct 6, 2023
05973a4
Catch NumberFormatException errors for delete, mark and unmark
janelleenqi Oct 6, 2023
2294806
Refine error messages
janelleenqi Oct 6, 2023
bfe863a
Add user guide within Luke application
janelleenqi Oct 6, 2023
bef32d4
Edit JavaDoc Comments
janelleenqi Oct 6, 2023
bd4a715
Minor Edit
janelleenqi Oct 6, 2023
e27b225
Fix Memory Saving for Task Completion Status
janelleenqi Oct 6, 2023
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
56 changes: 50 additions & 6 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,54 @@
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);
String logo = " _ _ \n"
+ "| | _ _| | _____ \n"
+ "| | | | | | |/ / _ \\\n"
+ "| |___| |_| | < __/\n"
+ "|_____|\\__,_|_|\\_\\___|\n";
System.out.println("Hello! I'm\n" + logo);
System.out.println("What can I do for you?");

Task[] theList = new Task[100];

Choose a reason for hiding this comment

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

Consider using a more descriptive name such as taskList instead of theList

Scanner userInput = new Scanner(System.in);
int counter = 0;
Copy link

Choose a reason for hiding this comment

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

Perhaps the counter variable could be more descriptive to allow the reader to understand what it is counting.


String echo = userInput.nextLine();

Choose a reason for hiding this comment

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

Can consider making some changes to the following variables:

  • echo should be renamed to userInputString instead since your default command is now adding a new task
  • userInput should contain the scanner keyword such as inputScanner to better signify that it is the scanner object

Choose a reason for hiding this comment

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

Consider using a more suitable name for echo so that it is more descriptive for the reader.


while (!echo.equals("bye")) {

Choose a reason for hiding this comment

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

Consider declaring static final constants for each command (e.g. bye, list, mark) so that they can be easily referenced and updated for future use

Suggested change
while (!echo.equals("bye")) {
private static final String BYE_COMMAND = "bye";
while (!echo.equals("bye")) {

String[] words = echo.split(" "); //to identify usage of features "mark" & "unmark"

if (echo.equals("list")) {
Copy link

Choose a reason for hiding this comment

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

Could potentially use a switch if possible to make the code more readable.

System.out.println("Here are the tasks in your list:");
for (int i = 0; i < counter; i += 1) {
System.out.print((i + 1) + ".");
theList[i].printTask();
}

} else if (words[0].equals("mark")) {
int taskNumber = Integer.parseInt(words[1]) - 1;
System.out.println("Woohoo! You have accomplished:");
theList[taskNumber].markAsDone();
theList[taskNumber].printTask();

} else if (words[0].equals("unmark")) {
int taskNumber = Integer.parseInt(words[1]) - 1;
System.out.println("HA! You still have to complete:");
theList[taskNumber].markAsIncomplete();
theList[taskNumber].printTask();

} else {
theList[counter] = new Task(echo);
System.out.println("added: " + echo);
counter += 1;
}

echo = userInput.nextLine();
}

System.out.println("Bye. Hope to see you again soon!");

userInput.close();
}
}
27 changes: 27 additions & 0 deletions src/main/java/Task.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
public class Task {

Choose a reason for hiding this comment

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

Good job for using good coding standards in this file! Descriptive names are used for functions and variables

protected String taskName;
protected boolean isDone;

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

public void printTask() {
System.out.println("[" + getStatusIcon() + "] " + taskName);
}

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

public void markAsDone() {
isDone = true;
}

public void markAsIncomplete() {
isDone = false;
}

//...
}
Copy link

Choose a reason for hiding this comment

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

I like your use of descriptive names to make the code clear and concise.