"depot M213"

This commit is contained in:
JunkJumper
2020-05-03 14:24:13 +02:00
parent 1408744dbb
commit e5983242c6
136 changed files with 161184 additions and 0 deletions

39013
TD10/-France_Codepostal_2009.txt Executable file

File diff suppressed because it is too large Load Diff

39013
TD10/-France_Codepostal_2009_esp.txt Executable file

File diff suppressed because it is too large Load Diff

106
TD10/-ListePokemon.txt Executable file
View File

@ -0,0 +1,106 @@
Bulbizarre Plante 0.7 6.9 294 62
Herbizarre Plante 1.0 13.0 324 74
Florizarre Plante 2.0 100.0 364 92
Salameche Feu 0.6 8.5 282 65 4
Reptincel Feu 1.1 19.0 320 76 4
Dracaufeu Feu 1.7 90.5 360 94 4
Carapuce Eau 0.5 9.0 292 61 4
Carabaffe Eau 1.0 22.5 322 75 4
Tortank Eau 1.8 85.5 362 93 4
Pikachu Electrik 0.4 6.0 274 67 4 0 50
Raichu Electrik 0.8 30.0 324 99 4 0 90
Goupix Feu 0.6 9.9 280 55 4
Feunard Feu 1.1 19.9 350 86 4
Mystherbe Plante 0.5 5.4 294 63
Ortide Plante 0.8 8.6 324 76
Rafflesia Plante 1.2 18.6 354 90
Paras Plante 0.3 5.4 274 81
Parasect Plante 1.0 29.5 324 103
Psykokwak Eau 0.8 19.6 304 65 4
Akwakwak Eau 1.7 76.6 364 92 4
Caninos Feu 0.7 19.0 314 81 4
Arcanin Feu 1.9 155.0 384 117 4
Ptitard Eau 0.6 12.4 284 63 3
Tetarte Eau 1.0 20.0 334 76 4
Tartard Eau 1.3 54.0 384 94 4
Chetiflor Plante 0.7 4.0 304 85
Boustiflor Plante 1.0 6.4 334 99
Empiflor Plante 1.7 15.5 364 112
Tentacool Eau 0.9 45.5 284 54 2
Tentacruel Eau 1.6 55.0 364 81 6
Ponyta Feu 1.0 30.0 304 94 4
Galopa Feu 1.7 95.0 334 108 4
Ramoloss Eau 1.2 36.0 384 76 5
Flagadoss Eau 1.6 78.5 394 85 5
Magneti Electrik 0.3 6.0 254 49 0 2 95
Magneton Electrik 1.0 60.0 304 72 0 6 120
Otaria Eau 1.1 90.0 334 58 3
Lamantine Eau 1.7 120.0 384 81 3
Kokiyas Eau 0.3 4.0 264 76 0
Crustabri Eau 1.5 132.5 304 103 0
Kraby Eau 0.4 6.5 264 112 2
Krabboss Eau 1.3 60.0 314 135 2
Voltorbe Electrik 0.5 10.4 284 45 0 1 55
Electrode Electrik 1.2 66.6 324 63 0 1 80
Noeunoeuf Plante 0.4 2.5 324 54
Noadkoko Plante 2.0 120.0 394 103
Saquedeneu Plante 1.0 35.0 334 67
Hypotrempe Eau 0.4 8.0 264 54 1
Hypocean Eau 1.2 25.0 314 76 1
Poissirene Eau 0.6 15.0 294 78 3
Poissoroy Eau 1.3 39.0 364 101 3
Stari Eau 0.8 34.5 264 58 1
Staross Eau 1.1 80.0 324 85 1
Elektek Electrik 1.1 30.0 334 93 4 0 95
Magmar Feu 1.3 44.5 334 103 4
Magicarpe Eau 0.9 10.0 244 27 3
Leviator Eau 6.5 235.0 394 130 1
Lokhlass Eau 2.5 220.0 464 94 2
Aquali Eau 1.0 29.0 464 76 7
Voltali Electrik 0.8 24.5 334 76 4 0 110
Pyroli Feu 0.9 25.9 334 135 4
Amonita Eau 0.4 7.5 274 54 2
Amonistar Eau 1.0 35.0 344 72 4
Kabuto Eau 0.5 11.5 264 90 1
Kabutops Eau 1.3 40.5 324 121 2
Electhor Electrik 1.6 52.6 384 99 2 2 125
Sulfura Feu 2.0 60.0 384 108 2
Germignon Plante 0.9 6.4 294 62
Macronium Plante 1.2 15.8 324 74
Meganium Plante 1.8 100.5 364 92
Hericendre Feu 0.5 7.9 282 65 4
Feurisson Feu 0.9 19.0 320 76 4
Typhlosion Feu 1.7 79.5 360 94 4
Kaiminus Eau 0.6 9.5 304 76 4
Crocrodil Eau 1.1 25.0 334 90 4
Aligatueur Eau 2.3 88.8 374 112 4
Loupio Electrik 0.5 12.0 354 52 2 2 56
Lanturn Electrik 1.2 22.5 454 70 0 2 76
Pichu Electrik 0.3 2.0 244 54 4 0 35
Wattouat Electrik 0.6 7.8 314 54 4 0 65
Lainergie Electrik 0.8 13.3 344 67 4 0 80
Pharamp Electrik 1.4 61.5 384 85 4 0 115
Joliflor Plante 0.4 5.8 354 90
Marill Eau 0.4 8.5 344 36 4
Azumarill Eau 0.8 28.5 404 63 6
Tarpaud Eau 1.1 33.9 383 85 4
Granivol Plante 0.4 0.5 274 49
Floravol Plante 0.6 1.0 314 58
Cotovol Plante 0.8 3.0 354 67
Tournegrin Plante 0.3 1.8 264 45
Heliatronc Plante 0.8 8.5 354 85
Axoloto Eau 0.4 8.5 314 58 2
Maraiste Eau 1.4 75.0 394 94 4
Roigada Eau 2.0 79.5 394 85 3
Qwilfish Eau 0.5 3.9 334 103 1
Limagma Feu 0.7 35.0 284 54 2
Volcaropod Feu 0.8 55.0 304 63 2
Corayon Eau 0.6 5.0 314 67 0
Remoraid Eau 0.6 12.0 274 76 2
Octillery Eau 0.9 28.5 354 112 2
Demanta Eau 2.1 220.0 334 54 2
Malosse Feu 0.6 10.8 294 72 4
Demolosse Feu 1.4 35.0 354 99 4
Hyporoi Eau 1.8 152.0 354 103 1
Elekid Electrik 0.6 23.5 294 75 4 0 65
Magby Feu 0.7 21.4 294 85 4

32
TD10/.vscode/launch.json vendored Executable file
View File

@ -0,0 +1,32 @@
{
"configurations": [
{
"type": "java",
"name": "CodeLens (Launch) - LectureFichierAffichage",
"request": "launch",
"mainClass": "input.LectureFichierAffichage",
"projectName": "TD10"
},
{
"type": "java",
"name": "CodeLens (Launch) - Partie",
"request": "launch",
"mainClass": "pokemon.Partie",
"projectName": "TD10"
},
{
"type": "java",
"name": "CodeLens (Launch) - LectureFichierEcritureESP",
"request": "launch",
"mainClass": "input.LectureFichierEcritureESP",
"projectName": "TD10"
},
{
"type": "java",
"name": "CodeLens (Launch) - LectureFichier",
"request": "launch",
"mainClass": "input.LectureFichier",
"projectName": "TD10"
}
]
}

View File

38230
TD10/France_Code_Postal_2009ESP.txt Executable file

File diff suppressed because it is too large Load Diff

0
TD10/France_Communes_2009.txt Executable file
View File

38891
TD10/France_Communes_2009ESP.txt Executable file

File diff suppressed because it is too large Load Diff

BIN
TD10/TD10.pdf Executable file

Binary file not shown.

View File

@ -0,0 +1,34 @@
package input;
import java.io.*;
public class LectureFichierAffichage {
public static void main(String[] args) {
try {
FileReader cp2009 = new FileReader("-France_Codepostal_2009.txt");
BufferedReader readerCP2009 = new BufferedReader(cp2009);
while (readerCP2009.ready()) {
String displayLine = readerCP2009.readLine();
System.out.println(displayLine);
}
readerCP2009.close();
cp2009.close();
} catch(FileNotFoundException e) {
System.err.println("Fichier non trouve");
} catch (IOException e) {
e.printStackTrace();
System.err.println("Fichier indisponible");
}
}
}

View File

@ -0,0 +1,49 @@
package input;
import java.io.*;
public class LectureFichierEcriture {
public static void main(String[] args) {
try {
FileReader cp2009 = new FileReader("-France_Codepostal_2009.txt");
FileWriter FC2009 = new FileWriter("France_Communes_2009.txt");
FileWriter C2009 = new FileWriter("France_Code_Postal_2009.txt");
BufferedReader readerCP2009 = new BufferedReader(cp2009);
BufferedWriter bufferCP = new BufferedWriter(C2009);
BufferedWriter bufferCommune = new BufferedWriter(FC2009);
while (readerCP2009.ready()) {
String displayLine = readerCP2009.readLine();
String[] tabs = displayLine.split("\t");
bufferCP.write(tabs[0]);
bufferCP.newLine();
bufferCommune.write(tabs[1]);
bufferCommune.newLine();
}
readerCP2009.close();
cp2009.close();
FC2009.close();
C2009.close();
} catch(FileNotFoundException e) {
System.err.println("Fichier non trouve");
} catch (IOException e) {
e.printStackTrace();
System.err.println("Fichier indisponible");
}
}
}

View File

@ -0,0 +1,55 @@
package input;
import java.io.*;
public class LectureFichierEcritureESP {
public static void main(String[] args) {
try {
FileReader cp2009 = new FileReader("-France_Codepostal_2009_esp.txt");
FileWriter FC2009 = new FileWriter("France_Code_Postal_2009ESP.txt");
FileWriter C2009 = new FileWriter("France_Communes_2009ESP.txt");
BufferedReader readerCP2009 = new BufferedReader(cp2009);
BufferedWriter bufferCP = new BufferedWriter(C2009);
BufferedWriter bufferCommune = new BufferedWriter(FC2009);
while (readerCP2009.ready()) {
String displayLine = readerCP2009.readLine();
String[] tabs = displayLine.split(" ");
tabs[(tabs.length) - 1] = "\t" + tabs[(tabs.length) - 1];
for (int i = 0; i < (tabs.length - 1); i++) {
bufferCP.write(tabs[i] + " ");
}
bufferCP.newLine();
bufferCommune.write(tabs.length);
bufferCommune.newLine();
}
readerCP2009.close();
cp2009.close();
FC2009.close();
C2009.close();
} catch(FileNotFoundException e) {
System.err.println("Fichier non trouve");
} catch (IOException e) {
e.printStackTrace();
System.err.println("Fichier indisponible");
}
}
}

121
TD10/src/pokemon/Joueur.java Executable file
View File

@ -0,0 +1,121 @@
package pokemon;
import java.util.*;
import java.lang.Math;
public class Joueur implements Comparable<Joueur> {
private String nom;
private int niveau; //Nombre pokemon captures
private int nbPoints; //Nombre pokemon actuel
private ArrayList<Pokemon> pokemon;
public Joueur() {
this.nom = null;
this.niveau = 1;
this.nbPoints = 0;
this.pokemon = new ArrayList<Pokemon>();
}
public Joueur(String s) {
this.nom = s;
this.niveau = 1;
this.nbPoints = 0;
this.pokemon = new ArrayList<Pokemon>();
}
public String toString() {
return "================================================================================\n" + "Le joueur " + this.nom + " a " + this.niveau + " pokemons!\nLes pokemons qu'il possede sont : " + this.pokemon.toString() + "\n================================================================================";
}
public int compareTo(Joueur j)
{
return this.getNom().compareTo(j.getNom());
}
public double vitesseMoyenne() {
if(pokemon.isEmpty())
{
return 0;
}
double moyenne = 0.;
for (Pokemon p : pokemon) {
moyenne += p.calculerVitesse();
}
return moyenne/pokemon.size();
}
public double vitesseMoyenne(String s) {
int count = 0;
if(pokemon.isEmpty())
{
return 0;
}
double moyenne = 0.;
for (Pokemon p : pokemon) {
if(p.getType().getDescription().equals(s))
{
moyenne += p.calculerVitesse();
count++;
}
}
return moyenne/count;
}
public void attrapePokemon(Pokemon p){
this.niveau++;
this.nbPoints++;
this.pokemon.add(p);
}
public void relachePokemon(Pokemon p) {
this.nbPoints--;
this.pokemon.remove(p);
}
public void attack(Object obj) {
Joueur j = (Joueur)obj;
int x = (int)Math.random()*this.getPokemon().size();
int y = (int)Math.random()*j.getPokemon().size();
this.pokemon.get(x).attack(this.pokemon.get(y));
j.pokemon.get(y).attack(this.pokemon.get(x));
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public int getNiveau() {
return niveau;
}
public void setNiveau(int niveau) {
this.niveau = niveau;
}
public int getNbPoints() {
return nbPoints;
}
public void setNbPoints(int nbPoints) {
this.nbPoints = nbPoints;
}
public ArrayList<Pokemon> getPokemon() {
return pokemon;
}
public void setPokemon(ArrayList<Pokemon> pokemon) {
this.pokemon = pokemon;
}
}

83
TD10/src/pokemon/Partie.java Executable file
View File

@ -0,0 +1,83 @@
package pokemon;
import java.io.*;
import java.util.*;
/*
new PokemonFEU(String n, double t, double p, int pv, int pc, int g)
new PokemonEAU(String n, double t, double p, int pv, int pc, int g)
new PokemonELECTRIK(String n, double t, double p, int pv, int pc, int g, int a, double i)
new PokemonPLANTE(String n, double t, double p, int pv, int pc)
*/
public class Partie {
public static void main(String[] args) {
ArrayList<Pokemon> listePKM = new ArrayList<Pokemon>();
try {
FileReader lecturePkm = new FileReader("-ListePokemon.txt");
BufferedReader bufferPkm = new BufferedReader(lecturePkm);
while (bufferPkm.ready()) {
String displayLine = bufferPkm.readLine();
String[] tabs = displayLine.split(" ");
String typePKM = tabs[1];
// nom - type - taille - poids - pv - pc
switch (typePKM) {
case "Feu":
PokemonFEU pF = new PokemonFEU(tabs[0], Double.parseDouble(tabs[2]), Double.parseDouble(tabs[3]),
Integer.parseInt(tabs[4]), Integer.parseInt(tabs[5]), Integer.parseInt(tabs[6]));
listePKM.add(pF);
// On créer ici un pokemon feu que l'on ajoute à notre ArrayList
break;
case "Eau":
PokemonEAU pE = new PokemonEAU(tabs[0], Double.parseDouble(tabs[2]), Double.parseDouble(tabs[3]),
Integer.parseInt(tabs[4]), Integer.parseInt(tabs[5]), Integer.parseInt(tabs[6]));
listePKM.add(pE);
// On créer ici un pokemon feu que l'on ajoute à notre ArrayList
break;
case "Plante":
PokemonPLANTE pP = new PokemonPLANTE(tabs[0], Double.parseDouble(tabs[2]),
Double.parseDouble(tabs[3]), Integer.parseInt(tabs[4]), Integer.parseInt(tabs[5]));
listePKM.add(pP);
// On créer ici un pokemon feu que l'on ajoute à notre ArrayList
break;
case "Electrik":
PokemonELECTRIK pEl = new PokemonELECTRIK(tabs[0], Double.parseDouble(tabs[2]),
Double.parseDouble(tabs[3]), Integer.parseInt(tabs[4]), Integer.parseInt(tabs[5]),
Integer.parseInt(tabs[6]), Integer.parseInt(tabs[7]), Double.parseDouble(tabs[8]));
listePKM.add(pEl);
// On créer ici un pokemon feu que l'on ajoute à notre ArrayList
break;
default:
System.err.println("Erreur");
break;
}
}
System.out.println(listePKM.toString());
bufferPkm.close();
lecturePkm.close();
} catch (FileNotFoundException e) {
System.err.println("Fichier non trouve");
} catch (IOException e) {
e.printStackTrace();
System.err.println("Fichier indisponible");
}
}
}

106
TD10/src/pokemon/Pokemon.java Executable file
View File

@ -0,0 +1,106 @@
package pokemon;
public abstract class Pokemon implements Comparable<Pokemon> {
private String nom;
private double taille; // en m
private double poids; // en kg
private int pv;
private int pc;
Type type;
public Pokemon() {
nom = null;
taille = 0.;
poids = 0.;
pv = 0;
pc = 0;
}
public Pokemon(String n, double t, double p, int pv, int pc) {
this.nom = n;
this.taille = t;
this.poids = p;
this.pv = pv;
this.pc = pc;
this.type = null;
}
public double calculerVitesse() {
return 0.;
}
public double attack(Pokemon p2) {
return 0;
}
@Override
public String toString() {
return this.getNom();
}
public int compareTo(Pokemon p)
{
int r = this.getType().getDescription().compareTo(p.getType().getDescription());
if (r == 0) {
return this.getPv() - p.getPv();
}
else {
return r;
}
}
//getters
public String getNom() {
return nom;
}
public double getTaille() {
return taille;
}
public double getPoids() {
return poids;
}
public int getPv() {
return pv;
}
public int getPc() {
return pc;
}
public Type getType() {
return type;
}
//setters
public void setNom(String nom) {
this.nom = nom;
}
public void setTaille(double taille) {
this.taille = taille;
}
public void setPoids(double poids) {
this.poids = poids;
}
public void setPv(int pv) {
this.pv = pv;
}
public void setPc(int pc) {
this.pc = pc;
}
public void setType(Type type) {
this.type = type;
}
}

View File

@ -0,0 +1,48 @@
package pokemon;
public class PokemonEAU extends Pokemon{
private int nb_nageoires;
public PokemonEAU(String n, double t, double p, int pv, int pc, int g) {
super.setNom(n);
super.setTaille(t);
super.setPoids(p);
super.setPv(pv);
super.setPc(pc);
this.type = Type.EAU;
nb_nageoires = g;
}
public int getNb_nageoires() {
return nb_nageoires;
}
public void changePv(int modif) {
this.setPv(Math.max(0, this.getPv() - modif));
}
@Override
public double calculerVitesse() {
return (this.getPoids() * nb_nageoires) / 25.0;
}
public String toString() {
return this.getNom();
}
@Override
public double attack(Pokemon p2) {
if(p2.type == Type.ELECTRIK) {
p2.setPv(p2.getPv()-this.getPc());
}
else if(p2.type == Type.FEU) {
p2.setPv((p2.getPv()-this.getPc()*2));
}
else {
p2.setPv((p2.getPv()-this.getPc()/2));
}
return 0;
}
}

View File

@ -0,0 +1,56 @@
package pokemon;
public class PokemonELECTRIK extends Pokemon {
private int nb_pattes;
private int nb_ailes;
private double intensite;
public PokemonELECTRIK(String n, double t, double p, int pv, int pc, int g, int a, double i) {
super.setNom(n);
super.setTaille(t);
super.setPoids(p);
super.setPv(pv);
super.setPc(pc);
this.type = Type.ELECTRIK;
nb_pattes = g;
nb_ailes = a;
intensite = i;
}
public int getPattes() {
return nb_pattes;
}
public int getAiles() {
return nb_ailes;
}
public double getIntensite() {
return intensite;
}
public void changePv(int modif) {
this.setPv(Math.max(0, this.getPv() - modif));
}
@Override
public double calculerVitesse() {
return (nb_ailes + nb_pattes) * intensite * 0.05;
}
public String toString() {
return this.getNom();
}
@Override
public double attack(Pokemon p2) {
if (p2.type == Type.FEU) {
p2.setPv(p2.getPv() - this.getPc());
} else if (p2.type == Type.EAU) {
p2.setPv((p2.getPv() - this.getPc() * 2));
} else {
p2.setPv((p2.getPv() - this.getPc() / 2));
}
return 0;
}
}

View File

@ -0,0 +1,47 @@
package pokemon;
public class PokemonFEU extends Pokemon {
private int nb_pattes;
public PokemonFEU(String n, double t, double p, int pv, int pc, int g) {
super.setNom(n);
super.setTaille(t);
super.setPoids(p);
super.setPv(pv);
super.setPc(pc);
this.type = Type.FEU;
nb_pattes = g;
}
public int getPattes() {
return nb_pattes;
}
public void changePv(int modif) {
this.setPv(Math.max(0, this.getPv() - modif));
}
@Override
public double calculerVitesse() {
return this.getPoids() * nb_pattes * 0.03;
}
public String toString() {
return this.getNom();
}
@Override
public double attack(Pokemon p2) {
if(p2.type == Type.FEU) {
p2.setPv(p2.getPv()-this.getPc());
}
else if(p2.type == Type.PLANTE) {
p2.setPv((p2.getPv()-this.getPc()*2));
}
else {
p2.setPv((p2.getPv()-this.getPc()/2));
}
return 0;
}
}

View File

@ -0,0 +1,41 @@
package pokemon;
public class PokemonPLANTE extends Pokemon{
public PokemonPLANTE(String n, double t, double p, int pv, int pc) {
super.setNom(n);
super.setTaille(t);
super.setPoids(p);
super.setPv(pv);
super.setPc(pc);
this.type = Type.PLANTE;
}
public void changePv(int modif) {
this.setPv(Math.max(0, this.getPv() - modif));
}
@Override
public double calculerVitesse() {
return 10.0 / (this.getPoids() * this.getTaille());
}
public String toString() {
return this.getNom();
}
@Override
public double attack(Pokemon p2) {
if(p2.type == Type.EAU) {
p2.setPv(p2.getPv()-this.getPc());
}
else if(p2.type == Type.ELECTRIK) {
p2.setPv((p2.getPv()-this.getPc()*2));
}
else {
p2.setPv((p2.getPv()-this.getPc()/2));
}
return 0;
}
}

106
TD10/src/pokemon/TestPokemon.java Executable file
View File

@ -0,0 +1,106 @@
package pokemon;
import java.util.*;
public class TestPokemon {
@SuppressWarnings("unused")
public static void main(String[] args) {
//fire
PokemonFEU Infernape = new PokemonFEU("Infernape", 1.2, 55., 356, 45, 4);
PokemonFEU Ninetales = new PokemonFEU("Ninetales", 1.1, 19.9, 350, 26, 4);
PokemonFEU Salameche = new PokemonFEU("Salameche",0.5,5.,50,10,4);
//Electric
PokemonELECTRIK Ampharos = new PokemonELECTRIK("Ampharos", 1.4, 61.5, 384, 32, 2, 0, 95);
PokemonELECTRIK RaichuA = new PokemonELECTRIK("Raichu Alolan Form", .7, 21., 324, 37, 2, 0, 105);
PokemonELECTRIK Voltali = new PokemonELECTRIK("Voltali", 1.8, 47.3, 120, 130, 4, 0, 12);
PokemonELECTRIK Pikachu = new PokemonELECTRIK("Pikachu", 0.9, 5.3, 90, 50, 4, 0, 12);
//water
PokemonEAU Ludicolo = new PokemonEAU("Ludicolo", 1.5, 55., 364, 45, 2);
PokemonEAU Froakie = new PokemonEAU("Froakie", .3, 7., 286, 20, 2);
PokemonEAU Aquali = new PokemonEAU("Aquali", 2.1, 56.3, 140, 90, 3);
PokemonEAU Carapuce = new PokemonEAU("Carapuce",0.5,5.,50,10,0);
//grass
PokemonPLANTE Roselia = new PokemonPLANTE("Roselia", .3, 2., 304, 14);
PokemonPLANTE Torterra = new PokemonPLANTE("Torterra", 2.2, 310., 394, 44);
PokemonPLANTE Phylali = new PokemonPLANTE("Phylali", 1.6, 28.5, 130, 70);
PokemonPLANTE Herbizarre = new PokemonPLANTE("Herbizarre",0.5,5.,50,10);
Joueur JunkJumper = new Joueur("JunkJumper");
Joueur Mkel = new Joueur("Mkel");
ArrayList<Pokemon> l1 = new ArrayList<Pokemon>();
ArrayList<Pokemon> l2 = new ArrayList<Pokemon>();
l1.add(Infernape);
l1.add(Ludicolo);
l1.add(Roselia);
l1.add(Ampharos);
l2.add(Voltali);
l2.add(Salameche);
l2.add(Froakie);
l2.add(Herbizarre);
l2.add(Torterra);
l2.add(Carapuce);
l2.add(Ninetales);
JunkJumper.setPokemon(l1);
Mkel.setPokemon(l2);
System.out.println("===== Collection 1 : =====");;
for (Pokemon pokemon : l1) {
System.out.println(pokemon.toString());
}
System.out.println("===== Collection 2 : =====");;
for (Pokemon pokemon : l2) {
System.out.println(pokemon.toString());
}
Collections.sort(l1);
Collections.sort(l2);
JunkJumper.setNiveau(4);
Mkel.setNiveau(7);
System.out.println("\n Tri par nom effectue");
System.out.println("===== Collection 1 : =====");;
for (Pokemon pokemon : l1) {
System.out.println(pokemon.toString());
}
System.out.println("===== Collection 2 : =====");;
for (Pokemon pokemon : l2) {
System.out.println(pokemon.toString());
}
ArrayList<Joueur> lj = new ArrayList<Joueur>();
lj.add(JunkJumper);
lj.add(Mkel);
for (Joueur joueur : lj) {
System.out.println(joueur.toString());
}
Collections.sort(lj);
System.out.println("\n Tri par nom effectue");
for (Joueur joueur : lj) {
System.out.println(joueur.toString());
}
System.out.println("Hello Pokeworld !");
}
}

19
TD10/src/pokemon/Type.java Executable file
View File

@ -0,0 +1,19 @@
package pokemon;
enum Type {
EAU("EAU"),
ELECTRIK("ELECTRIK"),
FEU("FEU"),
PLANTE("PLANTE");
Type(String s) {
description = s;
}
private String description;
public String getDescription() {
return description;
}
}