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

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;
}
}