Ajout des travaux effectuer

This commit is contained in:
2024-12-09 11:53:11 +01:00
parent 05fac8d3ae
commit c4e97e13da
558 changed files with 67900 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,27 @@
public class Moyenne
{
private double total = 0;
private long cpt = 0;
public void add(Number val)
{
total += val.doubleValue();
++cpt;
}
public double getAverage()
{
if(cpt == 0)
{
return 0;
}
return total/cpt;
}
public static void main(String[] args)
{
Moyenne m = new Moyenne();
m.add(5.5);
m.add(10);
System.out.println(m.getAverage());
}
}

View File

@@ -0,0 +1,7 @@
public interface take
{
public static void main(String[] args)
{
}
}

View File

@@ -0,0 +1,26 @@
import java.awt.Point;
public class Polyligne 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;
}
}

View File

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

View File

@@ -0,0 +1,16 @@
import javax.swing.JOptionPane;
public class Camion extends TestVehicules implements Vehicule {
@Override
public String sorte()
{
return "Camion";
}
@Override
public int nbRoues()
{
return 6;
}
}

Binary file not shown.

View File

@@ -0,0 +1,16 @@
import javax.swing.JOptionPane;
public class Moto extends TestVehicules implements Vehicule {
@Override
public String sorte()
{
return "Moto";
}
@Override
public int nbRoues()
{
return 2;
}
}

View File

@@ -0,0 +1,24 @@
import javax.swing.JOptionPane;
public class TestVehicules {
public static void main(String[] args) {
Vehicule v;
Object[] choix = {"Voiture", "Moto", "Camion"};
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 if (reponse == 1)
v = new Moto();
else
v = new Camion();
System.out.println("Une "+v.sorte()+" poss\u00E8de "+v.nbRoues()+" roues.");
}
}

View File

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

View File

@@ -0,0 +1,16 @@
import javax.swing.JOptionPane;
public class Voiture extends TestVehicules implements Vehicule {
@Override
public String sorte()
{
return "Voiture";
}
@Override
public int nbRoues()
{
return 4;
}
}