Etudes/BTS/Java/Premiere annee/figGeometrique/Carre.java

51 lines
948 B
Java
Raw Normal View History

2016-10-14 15:52:18 +00:00
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package figGeometrique;
/**
*
* @author therbron
*/
public class Carre {
final private int longueurDuCote;
Carre()
{
longueurDuCote = 5;
}
Carre(int longueurDuCote)
{
this.longueurDuCote = longueurDuCote;
}
int calculerAire()
{
int aire;
aire = longueurDuCote * longueurDuCote;
return aire;
}
int calculerPerimetre()
{
int perimetre;
perimetre = longueurDuCote * 4;
return perimetre;
}
void afficherPerimetre()
{
System.out.println("Perimetre = " + calculerPerimetre());
}
void afficherAire()
{
System.out.println("Aire = " + calculerAire());
}
}