I need help with a problem I'm having for a week now and it's driving me crazy. The slogan is the following: I have to create a TAD of Room and Box, maybe with another class that is called Accommodation (or maybe not). There is a room -which I will look at it as a matrix - , and a certain amount of boxes -which I also look at as matrices - . I will assign them 1 for occupied and 0 for unemployed. How can I compare the boxes and add them to the room matrix? I leave the first part of the statement, I would greatly appreciate if someone can help me with this issue.
** Exercise 1 Design and equals The administration of the UNGS asked us for help to make the removals to the modules new considering that boxes should be placed in different areas (room).
To accomplish this task, the problem will be modeled using a TADHabitation.
I) For the model, it is considered that:
a. -In a room boxes of n x m meters (Integers) are placed.
b. -Modeladelaremos the object that is inside the box with an Integer.
c. -We will not model the height of the room or the boxes. (i.e. the space will be in INxIN)
II) The idea is to fit the boxes inside the room with some criterion that decides each group, which complies with the IREP of the chosen implementation. It is not evaluated if the Box placement is optimal (because this problem is difficult), but the criteria for accommodating boxes can not be trivial (i.e. you have to try to take advantage of the space).
Conditions that, as a minimum, should be modeled by the IREP will be considered:
Can the boxes overlap?
What is the feasible size for a box?
public class Ejemplo
{
public static void main(String[] args)
{
// habitación de 20x10
Habitacionh1 = new Habitacion(20,10);
int cant = h1.cantCajas();
for (int i = 1; i< 10; i++)
{
if (h1.puedoAgregarCaja(i, i))
h1.agregarCaja(i, i, i);
}
System.out.println(h1);
}
}
**