Data structure Project

Create a generic class named ‘RandomDrawing’ with a single type parameter
that simulates drawing an item at random out of a box. For example, the box might contain Strings representing names written on a slip of paper, or the box might contain Integers representing a random drawing for a lottery based on numeric lottery picks. This class will include the following members (instance variables and methods): – A private instance variable named ‘box’ of type ArrayList to hold values. – A public void method named ‘add’ that allows the user of the class to add an object of the specified type (type T) to the box. – A Boolean method named ‘isEmpty’ that determines whether or not the box is empty. – A public method named ‘drawItem’ that randomly selects an object (an item) from the box and returns it. If the user attempts to draw an item out of an empty box, it returns null. However, if the box is not empty, the selected item is removed from the box before it is returned to the user (or the caller). – A toString method that returns a string representing the state of the box. – A clone method that clones an object of type RandomDrawing. This method must make a deep copy rather than a shallow copy of the object (see pages 519-521). Write a main method that tests your class. Do as follows: 1- Create two objects of type ‘RandomDrawing’, one to store objects of type String and another for objects of type Integer. 2- Add several values to the integer box and several values to the string box. 3- Draw from the integer box until it becomes empty and output each drawing on the screen. Do the same with the string box. 4- Include a loop in your main method so that step 3 can be repeated as often as the user wishes. Notice that the order in which items were drawn out of the boxes are different for each successive run. (Important note: You must clone your RandomDrawing objects at the beginning of this loop, and draw from those cloned objects rather than the original objects. Otherwise, there won’t be anything left to draw the next time through the loop, because the method drawItem removes the drawn item from the box.) Sample output: Your program output must match the following format, and the drawing boxes must be initialized with the values shown below. Programmer:type your name here!!!!!!

Course:COSC 211, Winter 22 Project:lab #10 Due date:4-14-22 Contents of the integer box (toString method): 35 12 100 10 72 Contents of the string box (toString method): Nancy Cathy Tom David Anna Adam Drawings from the integer box: 10 100 12 72 35 Drawings form the string box: Tom Nancy Cathy David Adam Anna Do it again, yes (or no)? Yes Drawings from the integer box: 35 72 10 100 12 Drawings form the string box: David Anna Nancy Adam Cathy Tom Do it again, yes (or no)? yes Drawings from the integer box: 72 100 12 10 35 Drawings form the string box: David Tom Nancy Adam Anna Cathy Do it again, yes (or no)? no