Question: I will be using MySQL can someone help me on this to better understand the question. This assignment assumes you are using XAMPP. Feel free

I will be using MySQL can someone help me on this to better understand the question.

This assignment assumes you are using XAMPP. Feel free to use your preferred MySQL software, as long as you can achieve the same outcomes.

Part 1. Database creation and population

1. Go to PhpMyAdmin and create a new database called shapedb.

2. Create a class, called ShapeCreator, which will be responsible for creating and populating the tables inside our database shapedb.

3. Inside ShapeCreator, create a method createTables() that creates a table for each shape type: a table for Circle, Rectangle and Triangle. To control for the integrity of records, we will add a column called id which will be set to auto-increment.

4. Then create a method populateTables() that randomly creates 10 objects of each type (10 Circles, 10 Rectangles, 10 Triangles). The values of their attributes (coordinates, sides, radius etc.) should be all between 1 and 20. The method saves these objects in the tables of the database shapedb.

Part 2. Shape objects overlap detection

5. Now we will update the super class Shape to support a method called overlaps(Shape s). This method if called by an object1, and having object2 passed as a parameter, it will detect if there is any overlap between these two objects in the space. If such overlap exists, then the method returns true, otherwise, it returns false. Examples of potential overlaps are shown in the following figure:

6. Add a method called createOverlap(), which adds a table called overlap. This table will contain the information related to the objects that are found to be overlapping.

7. Add a method called testOverlap(). This method loads the shapes from all tables, into an array list, then test all the object pairs to detect any potential overlap between them. Then it populates the table overlap with the corresponding results (found overlapping pairs).

8. Create a method called displayShapes(). This method should display to the user the overlapping objects and non-overlapping shapes details.

9. Add a main method to test all these methods

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 General Management Questions!