-
Notifications
You must be signed in to change notification settings - Fork 590
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
[PeterHW963] iP #641
Open
PeterHW963
wants to merge
67
commits into
nus-cs2103-AY2425S1:master
Choose a base branch
from
PeterHW963: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
[PeterHW963] iP #641
Conversation
This file contains 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
In build.gradle, the dependencies on distZip and/or distTar causes the shadowJar task to generate a second JAR file for which the mainClass.set("seedu.duke.Duke") does not take effect. Hence, this additional JAR file cannot be run. For this product, there is no need to generate a second JAR file to begin with. Let's remove this dependency from the build.gradle to prevent the shadowJar task from generating the extra JAR file.
Duke.java visually prints out "Duke" The assignment given is to rename the chatbot, and create a greet and exit message. Let's rename the file to Nether.java, its new name and create the greet and exit messages, along with a new visual print out of its name. "println" statements are the only lines edited as that is the only requirement for this increment.
Chatbot produces visual art of its name, greetings, and goodbye message when run. The assignment given is to have chatbot produce echo whenever the user inputs anything other than "bye". Let's create a Scanner object to receive user input and create an infinite loop of echoing the user input and listening for more input. We used a check inside the infinite loop for a "bye" input to break out of the loop and produce the goodbye message.
Chatbot echoes user input unless the user inputs "bye" The assignment given is to have the chatbot add whatever the user inputs into a list of tasks and to add another check for the input "list", to which the chatbot should return a numbered list of all the tasks the user has input so far. Let's create an array of size 100 to store the tasks input by user along with a counter to keep track of the current index in the array. When the user inputs "list", a for loop is used to iterate through the array and print out the entries. Additionally, an abstraction for printing the horizontal line output is made and the constants MAX_TASKS, EXIT_COMMAND, and LIST_COMMAND were created to improve reusability and readability.
Chatbot add whatever the user inputs into a list of tasks and prints a numbered list of all the tasks the user has input so far whenever the user inputs "list". The assignment given is to have the chatbot have the ability to mark/unmark tasks as done/not done when the user inputs "mark + (integer)" or "unmark + (integer)". Let's create a new class called Task to represent tasks. Task has a description, index, and an isDone status. Task class also has the necessary getters and setters. Next, let's implement an extra check for the user input (i.e. if the user input starts with "mark" or "unmark") that modifies the task object to be done or not done respectively. Additionally, an abstraction for displaying the task list is made and the constants MARK_AS_DONE and MARK_AS_NOT_DONE were created to improve reusability and readability. A new Task class was created to encapsulate the data and behavior of task objects, improve reusability, maintainability, and readability.
Chatbot adds whatever the user inputs into a list of tasks and prints a numbered list of all the tasks the user has input so far whenever the user inputs "list" along with its done/not done status. The assignment given is to have the chatbot have the ability to recognize what type of task is added, whether it is ToDos, Deadline, or Event type tasks and have the task type displayed when listing the tasks. Let's create new subclasses for the Task class to represent the 3 types of tasks. DeadlineTask has a by attribute and EventTask has from and to attributes. Each of these Task subclasses have their own constructor and toString methods. Next, let's implement a method that parses the user input into the correct number of parts to instantiate the respective tasks with. Inheritance was used to support multiple task types since the different tasks have some similarity between them.
Chatbot adds one of the 3 types of tasks the user inputs into a numbered list. The tasks can be marked as done or not done, and user can input "list" to view all the tasks written so far. The assignment given is to have the chatbot handle errors, especially when the user enters an unexpected input that the chatbot is not programmed to handle. Let's create a new exception called NetherException that can produce the corresponding error message. Additionally, an automated testing has been implemented.
Chatbot adds one of the 3 types of tasks the user inputs into a numbered list. The tasks can be marked as done or not done, and user can input "list" to view all the tasks written so far. Chatbot can also handle various inputs from the user. The assignment given is to have the chatbot able to receive delete commands to delete a task from the list. Let's add an extra check to the chatbot for a "delete" command to then remove the task from the list
Chatbot is initialized with a blank task list every time. The assignment given is to have the chatbot able to save task list data and load task list from existing data (if any) upon initialization. Let's create a new Storage class that handles the saving and loading of tasks from the data file. Also let's implement a method toSaveFormat for each task type that processes the existing task list data into a form that is easily processed later on for loading.
Chatbot can take any date and/or time format from user inputs. The assignment given is to have the chatbot able to validate input date/time and save task date/time using LocalDateTime. Additionally, the toString() method should also present the date/time of tasks in a more user-friendly way. Let's make use of the LocalDateTime and DateTimeFormatter to parse user date/time input, and later on, revert it into String when it needs to be printed for users to see.
Build configuration for gradle is default (i.e. mainClass was the Duke class) Let's change the mainClass to be the nether.Nether class (specific to my own iP)
LGTM! |
A lot of checkstyle tests were failing. Followed suggestions to correct all of them.
There is no special response message when the 'list' command is input with an empty task list. Creating a special response message makes the chatbot response more realistic. Let's create a guard case using an if statement to return a special response string when 'list' is input with an empty task list.
Abnormal user input such as inputting an empty string has not been handled. Assertion for this particular input is implemented. Let's use assert !Object.equals("", userInput) to then give the appropriate error, though it will not appear in the GUI.
Code has lapses in following the Code Quality given in this week's materials. The principles below has been followed now: - avoid long methods - avoid deep nesting - avoid complicated expressions - avoid magic numbers - make the code obvious - structure code logically - do not 'trip up' reader - practice Keep it simple, stupid - Single Level of Abstraction Principle - Make the happy path prominent - don't recycle variables or parameters - use default branchs - avoid empty catch blocks - delete dead code - Minimize scope of variables - Minimize code duplication
Improve Code Quality
Add assertions
Use streams
# Conflicts: # data/nether.txt
Updated README and added exit functionality.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Nether
Nether frees your mind of having to remember things you need to do. It's
FASTSUPER FAST to useAll you need to do is
And it is FREE!
Features:
If you are a Java programmer, you can use it to practice Java too. Here's the
main
method: