From 4aadb0784b59888792179c3648c88bb15ed6c529 Mon Sep 17 00:00:00 2001 From: NaychiMin Date: Mon, 13 Nov 2023 07:13:39 +0800 Subject: [PATCH] Format encoding of current dish price to 2dp. --- src/main/java/seedu/cafectrl/storage/Decoder.java | 1 - src/main/java/seedu/cafectrl/storage/Encoder.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/seedu/cafectrl/storage/Decoder.java b/src/main/java/seedu/cafectrl/storage/Decoder.java index 5df4e95e78..e96b1f5e8e 100644 --- a/src/main/java/seedu/cafectrl/storage/Decoder.java +++ b/src/main/java/seedu/cafectrl/storage/Decoder.java @@ -238,7 +238,6 @@ private static void decodeSalesData(String orderLine, ArrayList order orderLists.get(day).addOrder(orderedDish); } catch (Exception e) { logger.log(Level.WARNING, "Line corrupted: " + e.getMessage(), e); - System.out.println(e.getMessage()); ui.showToUser(ErrorMessages.INVALID_SALES_DATA + orderLine); } } diff --git a/src/main/java/seedu/cafectrl/storage/Encoder.java b/src/main/java/seedu/cafectrl/storage/Encoder.java index fb0fb7fc0a..974a0ec391 100644 --- a/src/main/java/seedu/cafectrl/storage/Encoder.java +++ b/src/main/java/seedu/cafectrl/storage/Encoder.java @@ -136,7 +136,7 @@ public static ArrayList encodeSales(Sales sales) { orderString.append((day + 1) + DIVIDER); orderString.append(order.getDishName() + DIVIDER); orderString.append(order.getQuantity() + DIVIDER); - orderString.append(order.getOrderedDish().getPrice() + DIVIDER); + orderString.append(String.format("%.2f", order.getOrderedDish().getPrice()) + DIVIDER); orderString.append(order.getIsComplete()); orderString.append(System.lineSeparator()); encodedList.add(String.valueOf(orderString));