The method/function has to be developed in a file called metalcam_exercise.cs, add no other code than the required method/function in this file. The method name and parameters are as follows:
public static void OrganiseSquares(List<Square> pio_Squares)
Method description:
The method OrganiseSquares gets a list of squares and modifies each square position so the squares are placed one next to the other in increasing size order along the X axis.
Parameter description:
pio_Squares: The list of squares as input (the squares objects will be modified, this is why its pio, parameter input output).
return: The return value will be void as the imputed Square objects will be modified to set their position according to the algorithm.
The class Square is as follows:
using System.Collections.Generic;
internal class Square
{
private double m_Lenght;
private double m_PositionX;
private double m_PositionY;
public Square(double p_Length)
{
m_Lenght = p_Length;
m_PositionX = 0;
m_PositionY = 0;
}
public void SetPosition(double p_PositionX, double p_PositionY)
{
m_PositionX = p_PositionX;
m_PositionY = p_PositionY;
}
public double GetLenght()
{
return m_Lenght;
}
public static void OrganiseSquares(List<Square> pio_Squares)
{
// YOUR CODE HERE
}
}