Skip to content
Snippets Groups Projects

Finish implementing Grocery

Merged Jon Bergland requested to merge implement-test-grocery into dev
2 files
+ 91
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -3,7 +3,7 @@ package stud.ntnu.idatt1005.model;
import java.util.Date;
/**
* This is a entity class representing groceries
* This is an entity class representing groceries
* It contains the name, quantity, category and expiration date of the grocery
*/
public class Grocery {
@@ -26,6 +26,17 @@ public class Grocery {
this.expirationDate = expirationDate;
}
/**
* Deep-copy constructor for the Grocery class
* @param grocery the grocery to be copied
*/
public Grocery(Grocery grocery) {
this.name = grocery.name;
this.quantity = grocery.quantity;
this.category = grocery.category;
this.expirationDate = grocery.expirationDate;
}
/**
* Get the name of the grocery
* @return the name of the grocery
@@ -50,9 +61,17 @@ public class Grocery {
return category;
}
/**
* Get the expiration date of the grocery
* @return the expiration date of the grocery
*/
public Date getExpirationDate() {
return expirationDate;
}
@Override
public String toString() {
return "Name: " + name + ", Quantity: " + quantity + ", Category: " + category + ", Expiration date: " + expirationDate;
}
}
Loading