No copies mi trabajo, maldito idiota.
This commit is contained in:
parent
86b8708e25
commit
eeede0f751
BIN
APL2.1/TP7/PolyLigne/Etoile.class
Normal file
BIN
APL2.1/TP7/PolyLigne/Etoile.class
Normal file
Binary file not shown.
25
APL2.1/TP7/PolyLigne/Etoile.java
Normal file
25
APL2.1/TP7/PolyLigne/Etoile.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
BIN
APL2.1/TP7/PolyLigne/ProducteurDePoints.class
Normal file
BIN
APL2.1/TP7/PolyLigne/ProducteurDePoints.class
Normal file
Binary file not shown.
5
APL2.1/TP7/PolyLigne/ProducteurDePoints.java
Normal file
5
APL2.1/TP7/PolyLigne/ProducteurDePoints.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import java.awt.Point;
|
||||||
|
|
||||||
|
public interface ProducteurDePoints {
|
||||||
|
Point suivant();
|
||||||
|
}
|
BIN
APL2.1/TP7/Véhicules/Main.class
Normal file
BIN
APL2.1/TP7/Véhicules/Main.class
Normal file
Binary file not shown.
19
APL2.1/TP7/Véhicules/Main.java
Normal file
19
APL2.1/TP7/Véhicules/Main.java
Normal 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.");
|
||||||
|
}}
|
BIN
APL2.1/TP7/Véhicules/Moto.class
Normal file
BIN
APL2.1/TP7/Véhicules/Moto.class
Normal file
Binary file not shown.
9
APL2.1/TP7/Véhicules/Moto.java
Normal file
9
APL2.1/TP7/Véhicules/Moto.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
public class Moto implements Vehicule {
|
||||||
|
int nbroues = 2;
|
||||||
|
public String sorte() {
|
||||||
|
return "moto";
|
||||||
|
}
|
||||||
|
public int nbRoues() {
|
||||||
|
return nbroues;
|
||||||
|
}
|
||||||
|
}
|
BIN
APL2.1/TP7/Véhicules/Vehicule.class
Normal file
BIN
APL2.1/TP7/Véhicules/Vehicule.class
Normal file
Binary file not shown.
4
APL2.1/TP7/Véhicules/Vehicule.java
Normal file
4
APL2.1/TP7/Véhicules/Vehicule.java
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
public interface Vehicule {
|
||||||
|
String sorte();
|
||||||
|
int nbRoues();
|
||||||
|
}
|
BIN
APL2.1/TP7/Véhicules/Voiture.class
Normal file
BIN
APL2.1/TP7/Véhicules/Voiture.class
Normal file
Binary file not shown.
9
APL2.1/TP7/Véhicules/Voiture.java
Normal file
9
APL2.1/TP7/Véhicules/Voiture.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
public class Voiture implements Vehicule {
|
||||||
|
int nbroues = 4;
|
||||||
|
public String sorte() {
|
||||||
|
return "voiture";
|
||||||
|
}
|
||||||
|
public int nbRoues() {
|
||||||
|
return nbroues;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user