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

[LinSiyan]iP #181

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open

[LinSiyan]iP #181

wants to merge 24 commits into from

Conversation

Celineyaa
Copy link

@Celineyaa Celineyaa commented Feb 7, 2024

[Level 0: Rename, Greet, Exit]

@Celineyaa Celineyaa changed the title Level 0: Rename, Greet, Exit [LinSiyan]iP Feb 7, 2024
@Celineyaa
Copy link
Author

Dear sir/madam,

Sorry to bother, however I tried to PR my master branch after I finished the level 1 2 and 3, but I can't find my pushed changes on my remote master branch, the updates only show up at the ipMyAnswer branch, however when I pushed in SourceTree, I chose both branches to push. So is there any way for me to show my updates on my master branches and send PR using my master branch? I will be grateful if you can do me this favor!

Yours,
Siyan

Copy link

@ChoonSiang ChoonSiang left a comment

Choose a reason for hiding this comment

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

Will need to avoid using magic numbers and apply abstraction to improve the readability of the main function.

@@ -0,0 +1,104 @@
import Duke.*;

Choose a reason for hiding this comment

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

Avoid importing *, should explicitly import the classes

Task[] tasks = new Task[100];
while (!userInput.contains("bye")) {

System.out.println("____________________________________________________________\n");

Choose a reason for hiding this comment

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

Should make this a constant since this line will be reused multiple times. Any changes made will also easily reflected.

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

indexOfMark = Integer.parseInt(userInput.split(" ")[1]) - 1;

Choose a reason for hiding this comment

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

Avoid use of magic number. Try to have a descriptive variable for them

import java.util.ArrayList;
import java.util.List;
public class Duke {
public static void main(String[] args) {

Choose a reason for hiding this comment

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

Very long function, more than 30 lines of code. Can consider abstracting out each command.

Copy link
Author

Choose a reason for hiding this comment

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

Could you please be more specific about the abstracting? Thanks!


public void markAsDone() {
this.isDone = true;
System.out.println("OK, I've marked this task as not done yet:\n");

Choose a reason for hiding this comment

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

Suggested change
System.out.println("OK, I've marked this task as not done yet:\n");
System.out.println("OK, I've marked this task as done\n");

public class ToDo extends Task {
public ToDo(String description) throws ArrayIndexOutOfBoundsException{
super(description);
//System.out.println(description + "yes");

Choose a reason for hiding this comment

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

Try to remove unused comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants