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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!