No copies mi trabajo, maldito idiota.

This commit is contained in:
Vieira Enzo 2022-03-28 15:37:13 +02:00
parent 86b8708e25
commit eeede0f751
12 changed files with 71 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,25 @@
import java.awt.Point;
public class Etoile implements ProducteurDePoints {
private static final int xCentre = 100;
private static final int yCentre = 100;
private static final double rayon = 90.0;
private static final double angleDepart = Math.PI/4.0;
private static final double angleIncrement = (4.0*Math.PI)/5.0;
private double numero;
public Etoile() {
this.numero = 0.0;
}
public Point suivant() {
Point p = null;
if (this.numero < 6.0) {
double angle = Etoile.angleDepart+this.numero*Etoile.angleIncrement;
p = new Point((int) (Etoile.rayon*Math.cos(angle)),
(int) (Etoile.rayon*Math.sin(angle)));
p.translate(Etoile.xCentre, Etoile.yCentre);
this.numero++;
} else {
this.numero = 0.0;
}
return p;
}
}

Binary file not shown.

View File

@ -0,0 +1,5 @@
import java.awt.Point;
public interface ProducteurDePoints {
Point suivant();
}

Binary file not shown.

View File

@ -0,0 +1,19 @@
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
Vehicule v;
Object[] choix = {"Voiture", "Moto"};
int reponse = JOptionPane.showOptionDialog(null,
"Quel v\u00E9hicule choisissez-vous ?",
"Question",
JOptionPane.DEFAULT_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
choix,
null);
if (reponse == 0)
v = new Voiture();
else
v = new Moto();
System.out.println("Une "+v.sorte()+" poss\u00E8de "+v.nbRoues()+" roues.");
}}

Binary file not shown.

View File

@ -0,0 +1,9 @@
public class Moto implements Vehicule {
int nbroues = 2;
public String sorte() {
return "moto";
}
public int nbRoues() {
return nbroues;
}
}

Binary file not shown.

View File

@ -0,0 +1,4 @@
public interface Vehicule {
String sorte();
int nbRoues();
}

Binary file not shown.

View File

@ -0,0 +1,9 @@
public class Voiture implements Vehicule {
int nbroues = 4;
public String sorte() {
return "voiture";
}
public int nbRoues() {
return nbroues;
}
}