Bug 302

Summary: Dish object accepts negative price
Product: Group20 Reporter: awkakavou2-c
Component: DishAssignee: Anders <agmller2-c>
Status: RESOLVED FIXED    
Severity: normal    
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Windows   
Deadline: 2019-11-06   

Description awkakavou2-c 2019-11-05 17:44:56 HKT
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.
Comment 1 Anders 2019-11-05 17:54:11 HKT
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".