This commit is contained in:
2023-10-23 13:23:36 +02:00
parent 667dae6f1a
commit 322b22f9bf
5711 changed files with 72953 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,10 @@
public class Moto implements Vehicule{
@Override
public int nbRoues(){
return 1;
}
@Override
public String sorte(){
return "bcaene";
}
}

Binary file not shown.

View File

@@ -0,0 +1,22 @@
import javax.swing.JOptionPane;
public class Test {
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.");
}
}

View File

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

View File

@@ -0,0 +1,10 @@
public class Voiture implements Vehicule{
@Override
public int nbRoues(){
return 4;
}
@Override
public String sorte(){
return "vuitore";
}
}