je faire une classe et pour une raison quelconque, il est l'erreur « ne peut pas trouver le symbole » pourerreur ne peut pas trouver le symbole
perimeter = width + length;
return perimeter;
Je ne sais pas pourquoi une erreur ne devrait se produire (ou s'il y a quelque chose d'autre mal avec mon code. Je viens de commencer java à l'école si des conseils seraient utiles.
/**
* A rectangle has a length and a width. Its perimeter can be calculated.
*/
public class Rectangle
{
private int length;
private int width;
/**
* Constructs a rectangle with a specified length and width
* @param len the length of the rectangle
* @param wid the width of the rectangle
*/
public Rectangle(int len, int wid)
{
length = 0;
width = 0;
}
/**
* Sets the length and width of the rectangle
* @param len the new length
* @param wid the new width
*/
public void setDimensions(int len, int wid)
{
length = len;
width = wid;
}
/**
* Returns the perimeter of the rectangle
* @return the perimeter of the rectangle
*/
public int calculatePerimeter()
{
perimeter = width + length;
return perimeter;
}
'parameter' est jamais définie? – Li357