Question: public int add (Grocery g) throws Exception { / / TODO 08: validate argument g, using Validation Framework try { Validator . validate(g) ; catch

public int add (Grocery g) throws Exception { / / TODO 08: validate argument g, using Validation Framework try { Validator . validate(g) ; catch (ValidationException ve) { ve . printStackTrace ( ) ; / / TODO 09: make a relevant call to a fridgeDSC method String name = g . getItemName ( ) ; int quantity = g. getQuantity ( ) ; FridgeDSC . SECTION section = g. getSection( ) ; int newId = fridgeDSC . addGrocery (name, quantity, section) ; // TODO 10: this method should return the id of the newly created grocery return newId; 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
