Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

2-dimensional space with rectangular coating

Could you give me an idea

Lets imagine that we are creating a 2 dimensional rectangular space. We assume that this space is empty and it does not have a mass.

We pant to place rectangular boxes in this space with the following assumptions;

All of the rectangular shapes will have the same density. For example, while a 1x1 square shape having 1 kg mass, a 3x1 rectangular shape will have 3 kg mass.

The shapes that will be placed in the space will have to be perpeticular to the space. For example, a 3x1 rectangular shape with (1,1) starting coordinate will have a box in <(3,1)> and another box in <(2,1)> .

You will assume that the total area of the shapes will be less than that of the space .

The coordinates of the shapes in the space will be assumed to be integer.

The shape class will have x,y coordinates, height, width and density properties.

The space class will have more than one shapes. While placing boxes in the space, you are required to define shapes height, width and density properties. When placing a shape into the space, the code should create random locations in the space and place the shapes in that location. If there is an overlap, the shape should be relocated.

Comments