diff --git a/docs/_ug/commands/StatisticsCommands.md b/docs/_ug/commands/StatisticsCommands.md index 154dc55e101..2fd0c760615 100644 --- a/docs/_ug/commands/StatisticsCommands.md +++ b/docs/_ug/commands/StatisticsCommands.md @@ -1,17 +1,17 @@ #### Display statistics: `stats` - - **Format**: `stats` > Displays relevant statistics collected by FoodRem. ```note These statistics include: -* Items that expire within the next 10 days * Total cost of wasted items -* Most expensive item in your inventory +* Top 3 most commonly used tags in your inventory +* Top 3 most costly items in your inventory + +The cost of an item is the price of the item multiplied by the number of those items in your inventory. ``` **Example Input:** @@ -25,15 +25,16 @@ stats Command Output Box: ```text -Items that expire within the next 10 days: -1. Onions 8 kg $1 (Bought Date: 10-10-2022) (Expiry Date: 10-11-2022) -2. Chicken 30 kg $4.20 (Bought Date: 10-10-2022) (Expiry Date: 15-10-2022) -3. Carrots 11 kg $0.60 (Bought Date: 10-10-2022) (Expiry Date: 26-10-2022) - +Statistics Total cost of wasted items: $120 -Most expensive item in your inventory: -Chicken 30 kg $4.20 (Bought Date: 10-10-2022) (Expiry Date: 15-10-2022) +Top 3 common tags: +Drinks Fridge Fruits + +Your top 3 items with highest value are as follows: +1. Onions 8 kg $1 (Bought Date: 10-10-2022) (Expiry Date: 10-11-2022) +2. Chicken 30 kg $4.20 (Bought Date: 10-10-2022) (Expiry Date: 15-10-2022) +3. Carrots 11 kg $0.60 (Bought Date: 10-10-2022) (Expiry Date: 26-10-2022) ``` diff --git a/src/main/java/seedu/foodrem/model/item/ItemPrice.java b/src/main/java/seedu/foodrem/model/item/ItemPrice.java index f88d73b223f..e71f5b7a26a 100644 --- a/src/main/java/seedu/foodrem/model/item/ItemPrice.java +++ b/src/main/java/seedu/foodrem/model/item/ItemPrice.java @@ -11,7 +11,7 @@ * Guarantees: details are present and not null, field values are validated, immutable. */ public class ItemPrice { - private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.00"); + private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.00"); private static final double DEFAULT_PRICE = 0; private final double itemPrice; diff --git a/src/main/java/seedu/foodrem/views/ItemView.java b/src/main/java/seedu/foodrem/views/ItemView.java index 412bb8b459c..a9684c30d25 100644 --- a/src/main/java/seedu/foodrem/views/ItemView.java +++ b/src/main/java/seedu/foodrem/views/ItemView.java @@ -48,7 +48,7 @@ public static Node from(Item item) { final Label priceValue = new Label(item.getPrice().toString()); priceValue.getStyleClass().add("bold"); final Label costLabel = new Label("Total Cost: $"); - final Label costValue = new Label(String.valueOf(item.getItemCost())); + final Label costValue = new Label(String.format("%.2f", item.getItemCost())); costValue.getStyleClass().add("bold"); final Label remarks = new Label(item.getRemarks().toString().isBlank() ? "-" : item.getRemarks().toString());