| Summary: | Dish object accepts negative price | ||
|---|---|---|---|
| Product: | Group20 | Reporter: | awkakavou2-c |
| Component: | Dish | Assignee: | Anders <agmller2-c> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | --- | ||
| Version: | unspecified | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Deadline: | 2019-11-06 | ||
I have identified the problem. Initially we didn't check for negative values in variable "d". The problem has been solved by throwing the following error, when a negative value is encountered:
IllegalArgumentException("Negative price");
The problem is solved, and I mark this bug as "resolved".
|
While creating a new dish object a negative price is accepted. Obviously the price should be above 0. public Dish(String s, double d, int i) { this.name = s; this.price = d; this.id = i; I believe there should me a message shown to the canteen management that an error has been made and the price should be > 0.