-
Notifications
You must be signed in to change notification settings - Fork 187
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
[hongyijie06] iP #179
base: master
Are you sure you want to change the base?
[hongyijie06] iP #179
Changes from 3 commits
f0ecd9c
e0b6eed
35ec609
0c16724
1b6ca15
6ef3078
b540106
c230255
bedc8ec
4793c54
c43aef3
e0bf4a2
7078d98
4de283c
e44d14e
011c695
0bc39f6
b1fd82d
61216db
996ba2b
7162ac7
7a5826c
4a60dbe
422ac12
2152ef7
b611a02
d141099
6752306
2f4b481
4f03af2
fbcc37c
456bcb0
dc9a769
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,45 @@ | ||
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 list[] = new String[100]; | ||
|
||
System.out.println("Hello! I'm apple"); | ||
System.out.println("What can I do for you?"); | ||
|
||
int index = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there should be one more space here for a 4 tab space |
||
|
||
String line = ""; | ||
|
||
|
||
|
||
while (!line.equals("bye")){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to look through the coding standard to see if there should be a space. There wasn't anything that specifically mentioned it, but all the examples had a space. It might be worth making this change throughout your code to keep it consistent. |
||
Scanner input = new Scanner(System.in); | ||
line = input.nextLine(); | ||
|
||
if (line.equals("bye")){ | ||
break; | ||
} | ||
|
||
if (line.equals("list")){ | ||
for (int i = 0; i < index; i ++) { | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can clean up random newlines like this |
||
System.out.println((i + 1) + ". " + list[i]); | ||
} | ||
}else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think adding a space between the "}" and "else" will follow coding standard more and keep the style of your code more consistent |
||
list[index] = line; | ||
System.out.println("added: " + line); | ||
} | ||
|
||
index ++; | ||
|
||
|
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, I think you can clean up these new lines |
||
|
||
} | ||
System.out.println("Bye. Hope to see you again soon!"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can try to use more methods e.g. sayBey() to make the program more extendable for the future levels. |
||
|
||
|
||
} | ||
} |
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.
Do you think it would be more beneficial to have a more descriptive name like "tasks"?
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.
That might be better! Thank you!