Question: Java Create a class called GiftExchange that simulates drawing a gift at random out of a box. The class is a generic class with a
Create a class called GiftExchange that simulates drawing a gift at random out of a box. The class is a generic class with a parameter of type T that represents a gift and where T can be a type of any class. The class must include the following An ArrayList instance variable that holds all the gifts, The ArrayList is referred to as theBox 2. A default constructors that creates the box. 3. An add method that adds a gift to the box 4. A drawGift method that 1. Ensure the box is not empty, 2. If not empty # it is empty returns null 1. Selects a gift at random from the Box 2. Removes that gift from the Box 3. Returns the selected gift. 5, You may add any other method(s) you think you need however no additionalnctionality is required. 6. No Javadoc or import statements required
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
