-
Notifications
You must be signed in to change notification settings - Fork 197
[irfandeen] iP #178
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
Open
irfandeen
wants to merge
39
commits into
nus-cs2113-AY2425S2:master
Choose a base branch
from
irfandeen:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[irfandeen] iP #178
Changes from 7 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
876151e
Add level 0 increment
irfandeen e614df3
Remove unused variables in WallE.java
irfandeen bf9e4bd
Add echo command functionality
irfandeen 290ffb1
Add list to store and list out tasks
irfandeen 90a643a
Add mark and unmark functionality to task list
irfandeen 827efec
Create Task class to represent tasks
irfandeen 7fec201
Modify code to adhere to coding standard
irfandeen b578e77
Add subclasses extending Task class
irfandeen a2e877e
Add toString() method to base class
irfandeen 9c6ad3e
Refactor WallE class to improve readability
irfandeen 46c910b
Add try catch for all exceptions
irfandeen 39abee7
Fix toString() methods
irfandeen 1918418
Add error handling
irfandeen cbafecb
Merge branch 'branch-Level-5'
irfandeen 6578450
Add Wall-E Exception class
irfandeen 5ca2ee5
Refactor code into Wall-E package
irfandeen 03306fb
feature: allow multi-word dates for events and deadlines
irfandeen bba9299
Refactor Task array into ArrayList for dynamic access
irfandeen e601a9f
Add delete task functionality
irfandeen 43d21ea
Add file parser. Processing file parser output TBC
irfandeen 45037e0
feature: persistence with text file
irfandeen 34ff431
Merge branch 'branch-Level-6'
irfandeen 0aec5e3
Resolve merge conflicts
irfandeen 43b40c8
Fix bugs arising from ArrayList access
irfandeen e0c8602
Add JAR manifest
irfandeen 543da72
Refactor to be more modularized. Full functionality not yet restored.
irfandeen 31afe02
Refactor complete. Fully functional and modularized
irfandeen 9e75e32
Add date time functionality to deadline
irfandeen da8b95b
Fix code style nit
irfandeen fe47074
Add find functionality to WallE
irfandeen e6338cd
Add JavaDoc comments for public methods and classes.
irfandeen 826535c
Merge pull request #1 from irfandeen/branch-Level-8
irfandeen bff51c2
Resolve conflicts between Find functionality and DateTime functionality
irfandeen 0f2aa02
Merge pull request #2 from irfandeen/branch-Level-9
irfandeen 300372a
Resolve conflicts between master and JavaDoc branch
irfandeen a1a16ed
Merge pull request #3 from irfandeen/branch-A-JavaDoc
irfandeen d13d5bd
Add Readme.md
irfandeen a106526
Fix bugs with deadline command
irfandeen 642d36b
Add input into UserInterface class
irfandeen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # Duke User Guide | ||
| # WallE User Guide | ||
|
|
||
| // Update the title above to match the actual product name | ||
|
|
||
|
|
||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| 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" : " "); | ||
| } | ||
|
|
||
| public void markAsDone() { | ||
| isDone = true; | ||
| } | ||
|
|
||
| public void unmarkAsDone() { | ||
| isDone = false; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import java.util.Scanner; | ||
|
|
||
| public class WallE { | ||
| public static void printLineBreak() { | ||
| String lineBreak = "\t_________________________________\n"; | ||
| System.out.print(lineBreak); | ||
| } | ||
|
|
||
| public static void printWithLineBreak(String response) { | ||
| printLineBreak(); | ||
| System.out.println("\t" + response); | ||
| printLineBreak(); | ||
| } | ||
|
|
||
| public static void printWithoutLineBreak(String response) { | ||
| System.out.println("\t" + response); | ||
| } | ||
|
|
||
| public static void printGreeting() { | ||
| String greeting = "Hello! I'm Wall-E!\n" + "\tWhat can I do for you?\n\n"; | ||
| printWithLineBreak(greeting); | ||
| } | ||
|
|
||
| public static void printExit() { | ||
| String exitMessage = "Bye. Hope to see you again soon!"; | ||
| printWithLineBreak(exitMessage); | ||
| } | ||
|
|
||
| public static void printTaskList(Task[] tasks, int size) { | ||
| printLineBreak(); | ||
| printWithoutLineBreak("Here are the tasks in your list: "); | ||
| for (int i = 0; i < size; i++) { | ||
| printWithoutLineBreak(Integer.toString(i + 1) + ". [" + tasks[i].getStatusIcon() + "] " | ||
| + tasks[i].description); | ||
| } | ||
| printLineBreak(); | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| printGreeting(); | ||
| Scanner reader = new Scanner(System.in); | ||
| String userInput = reader.nextLine(); | ||
| Task[] tasks = new Task[100]; | ||
| int size = 0; | ||
|
|
||
| // Echoes the input, unless input == bye | ||
| while (!userInput.equals("bye")) { | ||
| String[] params = userInput.split(" "); | ||
| int taskIndex = 0; | ||
|
|
||
| switch (params[0]) { | ||
| case "list": | ||
| printTaskList(tasks, size); | ||
| break; | ||
| case "mark": | ||
| taskIndex = Integer.parseInt(params[1]); | ||
| tasks[taskIndex - 1].markAsDone(); | ||
| printWithLineBreak("Nice! I've marked this task as done:\n" | ||
| + "\t [" + tasks[taskIndex - 1].getStatusIcon() + "] " | ||
| + tasks[taskIndex - 1].description); | ||
| break; | ||
| case "unmark": | ||
| taskIndex = Integer.parseInt(params[1]); | ||
| tasks[taskIndex - 1].unmarkAsDone(); | ||
| printWithLineBreak("OK, I've marked this task as not done yet:\n" | ||
| + "\t " + "[ ] " + tasks[taskIndex - 1].description); | ||
|
||
| break; | ||
| default: | ||
| tasks[size] = new Task(userInput); | ||
| size++; | ||
| printWithLineBreak("added: " + userInput); | ||
| } | ||
|
||
|
|
||
| userInput = reader.nextLine(); | ||
| } | ||
|
|
||
| printExit(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very neat code for the different functions!