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

[CHEN ZIHAN] ip #198

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1f84246
This is greed for level0
ZIZI-czh Jan 31, 2023
a1b47d9
edit duke
ZIZI-czh Jan 31, 2023
150d2b1
This is level 1 code
ZIZI-czh Jan 31, 2023
9fb9073
This is level 2
ZIZI-czh Jan 31, 2023
1948f11
Level 3: Mark as Done
ZIZI-czh Feb 4, 2023
20513b3
Level 4: ToDos, Events, Deadlines
ZIZI-czh Feb 14, 2023
2f37e5d
A-TextUiTesting: Automated Text UI Testing
ZIZI-czh Feb 14, 2023
aad1876
A-CodeQuality: Improve Code Quality
ZIZI-czh Feb 14, 2023
52c2484
This is branch-Level-5 which includes Level 5: Handle Errors
ZIZI-czh Feb 14, 2023
2531402
This is branch-level-5 which includes Level 5: Handle Errors
ZIZI-czh Feb 14, 2023
46b06d9
update brach for package
ZIZI-czh Feb 16, 2023
bc3b345
create package and assign each file to the respective packages
ZIZI-czh Feb 16, 2023
feac7eb
This is incomplete delete
ZIZI-czh Feb 16, 2023
96306a3
Solve merge conflict
ZIZI-czh Feb 16, 2023
31edec0
This is level 6
ZIZI-czh Feb 16, 2023
3d14bd2
Change in branch-level-6
ZIZI-czh Feb 16, 2023
5673757
Level 6 and part of level 7
ZIZI-czh Feb 24, 2023
cd4ec76
no message
ZIZI-czh Feb 24, 2023
07841ce
This is level 7
ZIZI-czh Feb 25, 2023
3bce789
This is level 7
ZIZI-czh Feb 25, 2023
18ced02
solve conflict
ZIZI-czh Feb 26, 2023
a8b8903
clean space
ZIZI-czh Mar 4, 2023
8260134
A-moreOOP
ZIZI-czh Mar 5, 2023
c6c4e31
solve for conflict
ZIZI-czh Mar 5, 2023
c44b7a0
Implement the function of find
ZIZI-czh Mar 5, 2023
da48b0a
level-9 formatting
ZIZI-czh Mar 5, 2023
31518e0
This is JavaDoc
ZIZI-czh Mar 5, 2023
144ebda
changes
ZIZI-czh Mar 5, 2023
aca6055
Update README
ZIZI-czh Mar 5, 2023
3d4ec2e
Update README
ZIZI-czh Mar 6, 2023
91ab442
update
ZIZI-czh Mar 6, 2023
2ca723e
update
ZIZI-czh Mar 9, 2023
9717c16
Merge branch 'master' into branch-Level-9
ZIZI-czh Mar 15, 2023
330455f
Merge pull request #1 from ZIZI-czh/branch-Level-9
ZIZI-czh Mar 15, 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
45 changes: 37 additions & 8 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,54 @@
import java.util.Scanner;

public class Duke {
public static void main(String[] args) {

boolean isByeEntered = true;
String outputs;
public static final int MAX_INT = 100;
Copy link

Choose a reason for hiding this comment

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

Nice! I like your usage of constants (instead of magic numbers) and I like how they are typed (all uppercase, underscore to separate words).


public static void greeting() {
System.out.println(" Hello! I'm Duke");
System.out.println(" What can I do for you?");

while(isByeEntered) {
}



Choose a reason for hiding this comment

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

remove the unnecessary blank spaces, follow one uniform spacing

public static void add() {

Choose a reason for hiding this comment

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

Coding Standard violation: Ambiguity of function.

Can change the name of the function to explain more. e.g. addTodo()

boolean isByeEntered = true;
Copy link

Choose a reason for hiding this comment

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

Could isByeEntered be named to sound more like a boolean variable? It is a bit confusing what isByeEntered does just based off its name 😁 .

String outputs;

Choose a reason for hiding this comment

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

Coding Standard Violation: Plural form is reserved for collections of objects.

Suggested change
String outputs;
String output

String[] storeList;

Choose a reason for hiding this comment

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

Coding Standard Violation: Array should be plural

Suggested change
String[] storeList;
String[] storeLists;

Copy link

Choose a reason for hiding this comment

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

I like how your array specifier is attached to the type and not the variable 👍 nice

storeList = new String[MAX_INT];
int i = 0;
int a = 1;
Copy link

Choose a reason for hiding this comment

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

I wasn't sure on what a did until I read the code fully... I think changing the variable name a could make it more understandable for readers!


while (isByeEntered) {
Scanner scan = new Scanner(System.in);
outputs = scan.nextLine();
if(outputs.equals("bye")){
if (outputs.equals("bye")) {
System.out.println("Bye. Hope to see you again soon!");
return;
}else{
System.out.println(outputs);
} else if(outputs.equals("list")){

Choose a reason for hiding this comment

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

Coding Standard Violation: Give space before and after statement

Suggested change
} else if(outputs.equals("list")){
} else if(outputs.equals("list")) {

Choose a reason for hiding this comment

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

same goes for line 30, 35

for(String list : storeList){
if(list!=null) {
System.out.println(a + ". " + list);
a++;
}else{
Copy link

Choose a reason for hiding this comment

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

Spacing is sometimes inconsistent (maybe by accident?). Here, }else{ has no spaces between the braces but elsewhere, there are spaces. I noticed this a few times in the above code too. Be sure to double check!

break;
}
}

} else {
System.out.println("added: " + outputs);
storeList[i] = outputs;
i++;
}

}
}


public static void main(String[] args) {

greeting();
add();



Expand Down