Objectives: To design and implement an application in JavaFX and to use JDBC for data persistence.
The aim of the assignment is to create an application to maintain a collection of groceries stored in your
The groceries and a list of items are stored in a MySQL database.
The system consists of the following main classes:
1. Grocery –
The Grocery class represents a grocery item bought and stored in your fridge. The complete class code
is provided. As can be seen from the provided code, the class has the following attributes:
• id: the unique identifier of a grocery.
• item: an instance of Item class.
o Item class, (provided) has the following attributes:
name: the name of an item from which you can pick to make a Grocery object
expires: whether or not this item can expire
• date: the date the grocery item was purchased/added to the fridge.
• quantity: quantity of such grocery item bought/added to the fridge at the same time.
• section: which section of the fridge is the grocery stored.
The id attribute of a grocery is of type int and is auto-generated by the database, as can be seen in the
(So, you may ask: why do we have the constructor in the Grocery class? This is for you to figure out.)
2. Item –
The second class, Item, has a one to one mapping with the Grocery class where Grocery class has one
(and only one) instance of Item. As can be seen from the provided code, the class has following
• name: the unique identifier for an Item
• expires: a Boolean specifying if an Item has an expiration date or not. The default is False