public class Rectangle {
int sommet = 0;
int gauche = 0;
int largeur = 0;
int hauteur = 0;
public void initialiser(int sommet){
this.sommet = sommet;
}
public void intitaliser(int sommet, int gauche) {
this.sommet = sommet;
this.gauche = gauche;
}
public void intitaliser(int sommet, int gauche, int largeur) {
this.sommet = sommet;
this.gauche = gauche;
this.largeur = largeur;
}
public void intitaliser(int sommet, int gauche, int largeur, int hauteur) {
this.sommet = sommet;
this.gauche = gauche;
this.largeur = largeur;
this.hauteur = hauteur;
}
//écris ton code ici
public static void main(String[] args) {
}
}
What's wrong with my code ?
Discussion en cours
Commentaires (1)
- Populaires
- Nouveau
- Anciennes
Tu dois être connecté(e) pour laisser un commentaire
Gellert Varga
24 mai 2020, 19:32
1) Requirement: "create a copy of another rectangle passed as an argument"
- But you did not create an initialization method that receives a Rectangle object.
This method copies the values of the received object, thus creating a new object, a copy.
2) I think, with only one passed argument nobody can create a rectangle... This would be only a line:)
(For a rectangle you need not only a width, but a height too)
0