-
Notifications
You must be signed in to change notification settings - Fork 35
[W5][M11-2]Lew Sheng Kok #29
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
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -6,6 +6,8 @@ | |
| import seedu.addressbook.data.person.UniquePersonList.DuplicatePersonException; | ||
| import seedu.addressbook.data.person.UniquePersonList.PersonNotFoundException; | ||
|
|
||
| import java.util.Scanner; | ||
|
|
||
| /** | ||
| * Represents the entire address book. Contains the data of the address book. | ||
| */ | ||
|
|
@@ -74,4 +76,6 @@ public boolean equals(Object other) { | |
| || (other instanceof AddressBook // instanceof handles nulls | ||
| && this.allPersons.equals(((AddressBook) other).allPersons)); | ||
| } | ||
|
|
||
|
|
||
|
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. Probably these whitespaces are not needed. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -249,4 +249,7 @@ private Command prepareFind(String args) { | |
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,13 +6,15 @@ | |
| import static seedu.addressbook.common.Messages.MESSAGE_USING_STORAGE_FILE; | ||
| import static seedu.addressbook.common.Messages.MESSAGE_WELCOME; | ||
|
|
||
| import java.awt.geom.NoninvertibleTransformException; | ||
| import java.io.InputStream; | ||
| import java.io.PrintStream; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import java.util.Scanner; | ||
|
|
||
| import seedu.addressbook.Main; | ||
| import seedu.addressbook.commands.CommandResult; | ||
| import seedu.addressbook.data.person.ReadOnlyPerson; | ||
|
|
||
|
|
@@ -169,4 +171,33 @@ private static String getIndexedListItem(int visibleIndex, String listItem) { | |
| return String.format(MESSAGE_INDEXED_LIST_ITEM, visibleIndex, listItem); | ||
| } | ||
|
|
||
| public static String[] notes() { | ||
| Scanner input = new Scanner(System.in); | ||
| System.out.println("How many items are there?"); | ||
| int number = input.nextInt(); | ||
| int counter; | ||
| String[] instruct = new String[number+1]; | ||
| for (counter = 0; counter <= number; counter++) { | ||
| String str = input.nextLine(); | ||
| if (str.equals("done")) { | ||
| break; | ||
| } else { | ||
| instruct[counter] = str; | ||
| } | ||
| } | ||
| System.out.println("Noted down"); | ||
|
|
||
| return instruct; | ||
| } | ||
|
|
||
| public static void viewNotes(){ | ||
| String[] result = Main.getnote(); | ||
| for(String str: result){ | ||
| System.out.println(str); | ||
| } | ||
|
|
||
|
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. Kindly note that this method "notes" is failing SE principles. Ways to improve would include following SLAP and SRP (printing, input, etc. all happening at the same place right now). |
||
|
|
||
| } | ||
|
|
||
|
|
||
| } | ||
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.
Should probably have Notes as its own class instead of being in Main.
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.
Agreed. A proper design would require Note to be a class which associates itself to a Person.