Hi, I noticed that there isn't any fixed number for the discount, meaning that some discount values are available to input, but don't make sense. For example I entered discount d = -5, which later makes the price of the dish: "price * discount",resulting in the price of the dish being less than zero. A fix should be made that only positive values should be allowed. public ComboItem(String n, ArrayList<Item> l, double d, int i //* not relevant code *// this.discount = d; }
Thank you for the bug. I've added an if-else statement to code part you've mentioned to make sure that the discount value is between 0 and 1.00. See code below: if(d > 0 && d < 1.00) this.discount = d; else throw new IllegalArgumentException("Discount out of bounds"); I mark this bug as fixed.