forked from nus-cs2103-AY2122S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from AY2122S1-CS2103-F10-4/sherwin-refactor-c…
…ommand-messages-sort-commission Sherwin refactor sort policy comparators, commission for download and command messages
- Loading branch information
Showing
54 changed files
with
273 additions
and
190 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package seedu.siasa.commons.util; | ||
|
||
public class CurrencyUtil { | ||
/** | ||
* Converts money in cents to dollars in string format. | ||
* @param moneyInCents Money in cents. | ||
* @return Dollars in string. | ||
*/ | ||
public static String centsToDollars(int moneyInCents) { | ||
int cents = moneyInCents % 100; | ||
int dollars = (moneyInCents - cents) / 100; | ||
|
||
String centsStr; | ||
if (cents <= 9) { | ||
centsStr = 0 + "" + cents; | ||
} else { | ||
centsStr = Integer.toString(cents); | ||
} | ||
|
||
return "$" + dollars + "." + centsStr; | ||
} | ||
} |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
import seedu.siasa.model.tag.Tag; | ||
|
||
/** | ||
* Edits the details of an existing contact in the address book. | ||
* Edits the details of an existing contact in the SIASA. | ||
*/ | ||
public class EditContactCommand extends Command { | ||
|
||
|
@@ -49,8 +49,8 @@ public class EditContactCommand extends Command { | |
+ PREFIX_EMAIL + "[email protected]"; | ||
|
||
public static final String MESSAGE_EDIT_CONTACT_SUCCESS = "Edited Contact: %1$s"; | ||
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided."; | ||
public static final String MESSAGE_DUPLICATE_CONTACT = "This contact already exists in the address book."; | ||
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided"; | ||
public static final String MESSAGE_DUPLICATE_CONTACT = "This contact already exists in the SIASA"; | ||
|
||
private final Index index; | ||
private final EditContactDescriptor editContactDescriptor; | ||
|
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
15 changes: 10 additions & 5 deletions
15
src/main/java/seedu/siasa/logic/commands/contact/ListContactCommand.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
package seedu.siasa.logic.commands.contact; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.siasa.commons.core.Messages.MESSAGE_CONTACTS_LISTED_OVERVIEW; | ||
import static seedu.siasa.commons.core.Messages.MESSAGE_CONTACTS_LIST_EMPTY; | ||
import static seedu.siasa.model.Model.PREDICATE_SHOW_ALL_CONTACTS; | ||
|
||
import seedu.siasa.logic.commands.Command; | ||
import seedu.siasa.logic.commands.CommandResult; | ||
import seedu.siasa.model.Model; | ||
|
||
/** | ||
* Lists all contacts in the address book to the user. | ||
* Lists all contacts in the SIASA to the user. | ||
*/ | ||
public class ListContactCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "allcontact"; | ||
|
||
public static final String MESSAGE_SUCCESS = "Listed all contacts"; | ||
|
||
|
||
@Override | ||
public CommandResult execute(Model model) { | ||
requireNonNull(model); | ||
model.updateFilteredContactList(PREDICATE_SHOW_ALL_CONTACTS); | ||
return new CommandResult(MESSAGE_SUCCESS); | ||
|
||
if (model.getFilteredContactList().size() > 0) { | ||
return new CommandResult(String.format(MESSAGE_CONTACTS_LISTED_OVERVIEW, | ||
model.getFilteredContactList().size())); | ||
} else { | ||
return new CommandResult(MESSAGE_CONTACTS_LIST_EMPTY); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.