X502: Arrays - Verify Produce

A local grocery store has asked you to design a method to verify if their produce is okay to put on the shelves. The method takes an array of ints which represent the ages of various produce items. If an item is less than 4 days old, or more than 24, it should not be put on the shelves, and the method should return false. Otherwise, it should return true.

Examples:

verifyProduce({5,7,14,20,24}) -> true
verifyProduce({16,3,12,13}) -> false
verifyProduce({14,20,23,26}) -> false

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.