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

Created Type attribute for Menu and changed Regex for Price #88

Merged
merged 25 commits into from Oct 25, 2018

Conversation

SalsabilTasnia
Copy link
Collaborator

No description provided.

@SalsabilTasnia SalsabilTasnia added the status.ongoing The issue is currently being worked on. note: remove this label before closing an issue. label Oct 22, 2018
and convertPricetoString()
Copy link
Collaborator

@kianhong95 kianhong95 left a comment

Choose a reason for hiding this comment

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

Needs to rename instances of "address book" in comments to "Rms".
"PHONE_VALIDATION_REGEX" under Price class (possible mistake in naming?)

return priceIndouble;
}

public String convertPricetoString(double priceIndouble){
Copy link
Collaborator

Choose a reason for hiding this comment

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

This method can be adjusted to convert the double to the correct 2 digits after the dot format

public static final String MESSAGE_PRICE_CONSTRAINTS = "Price should be in SGD and in dollars and cents";
public static final String PHONE_VALIDATION_REGEX = "\\d+";//"^\\$\\d+([.][0-9]+)?$";
public static final String PHONE_VALIDATION_REGEX = "\\$[1-9][0-9]*(\\.[0-9]{2})?|\\$0?\\.[0-9][0-9]";//"^\\$\\d+([.][0-9]+)?$";
Copy link
Collaborator

Choose a reason for hiding this comment

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

PRICE_VALIDATION_REGEX can be adjusted to accept price with only one digit after the dot

builder.append(getPrice());
return builder.toString();
}

/**
* Formats a menu item as text, showing only non-private contact details.
*/
default String getAsTextHidePrivate() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should merge getAsTextShowAll() and getAsTextShowPrivate() into one single method getAsText()

@SalsabilTasnia SalsabilTasnia added the status.review-pending The pull request is ready to be reviewed. label Oct 24, 2018
@@ -45,6 +45,11 @@ public static String convertPricetoString(double priceIndouble){
if((valueAsPrice.substring(decimalIndex)).length()<3){
valueAsPrice = valueAsPrice + "0";
}
if((valueAsPrice.substring(decimalIndex)).length()>3){
priceIndouble = Math.round(priceIndouble*100.0)/100.0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The result of this calculation may create a result of 0 or 1 digit after the dot, which makes the string format not to have exactly 2 digits after the dot.

@AngWM AngWM merged commit 903a84e into CS2113-AY1819S1-F09-2:master Oct 25, 2018
@kianhong95 kianhong95 added the status.completed The pull request has been reviewed. label Oct 25, 2018
@kianhong95 kianhong95 removed status.ongoing The issue is currently being worked on. note: remove this label before closing an issue. status.review-pending The pull request is ready to be reviewed. labels Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status.completed The pull request has been reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants