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

Java  Java Create a class called GiftExchange that simulates drawing a gift

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

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 Databases Questions!