//use case 2.6 public void addToCart(Session user, int product, int amount) { if (product < 0) { throw new ArgumentException("invalid product id"); } if (amount <= 0) { throw new IllegalAmountException("error : amount should be a positive number"); } db.addToCart(user, product, amount); }
//use case 2.6 public void addToCart(int user, int product, int amount) { if (product < 0) { throw new ILLArgumentException("invalid product id"); } if (amount <= 0) { throw new AlreadyExistException("error : amount should be a positive number"); } db.addToCart(user, product, amount); }