diff --git a/DEV2.1/TP0:Introduction/Arguments.class b/DEV2.1/TP0:Introduction/Arguments.class new file mode 100644 index 0000000..cbb6fc5 Binary files /dev/null and b/DEV2.1/TP0:Introduction/Arguments.class differ diff --git a/DEV2.1/TP0:Introduction/Arguments.java b/DEV2.1/TP0:Introduction/Arguments.java new file mode 100644 index 0000000..fa078d2 --- /dev/null +++ b/DEV2.1/TP0:Introduction/Arguments.java @@ -0,0 +1,19 @@ +/** +* Cette classe est une simple coquille pour recevoir la methode principale +* +* @version 1.1 09 March 2014 +* @author Luc Hernandez +*/ +public class Arguments { + + /** + * Affiche «Bonjour !» + * + * @param args la liste des arguments de la ligne de commande (inutilisee ici) + */ + public static void main(String[] args) { + for(int i=0;i<args.length;i++){ + System.out.println("Bonjour "+args[i]+" !"); + } + } +} \ No newline at end of file diff --git a/DEV2.1/TP0:Introduction/Demarrage.class b/DEV2.1/TP0:Introduction/Demarrage.class new file mode 100644 index 0000000..3fdcaf2 Binary files /dev/null and b/DEV2.1/TP0:Introduction/Demarrage.class differ diff --git a/DEV2.1/TP0:Introduction/Demarrage.java b/DEV2.1/TP0:Introduction/Demarrage.java new file mode 100644 index 0000000..0b3259d --- /dev/null +++ b/DEV2.1/TP0:Introduction/Demarrage.java @@ -0,0 +1,17 @@ +/** +* Cette classe est une simple coquille pour recevoir la methode principale +* +* @version 1.1 09 March 2014 +* @author Luc Hernandez +*/ +public class Demarrage { + + /** + * Affiche «Bonjour !» + * + * @param args la liste des arguments de la ligne de commande (inutilisee ici) + */ + public static void main(String[] args) { + System.out.println("Bonjour !"); + } +} \ No newline at end of file diff --git a/DEV2.1/TP0:Introduction/Grille.class b/DEV2.1/TP0:Introduction/Grille.class new file mode 100644 index 0000000..249137e Binary files /dev/null and b/DEV2.1/TP0:Introduction/Grille.class differ diff --git a/DEV2.1/TP0:Introduction/Grille.java b/DEV2.1/TP0:Introduction/Grille.java new file mode 100644 index 0000000..ef9ad6b --- /dev/null +++ b/DEV2.1/TP0:Introduction/Grille.java @@ -0,0 +1,24 @@ +public class Grille{ + public static void main(String[] args) { + int n = Integer.parseInt(args[0]); + for(int i=0;i<=2*n;i++){ + if(i%2==0){ + for(int j=0;j<=2*n;j++){ + if(j%2==0){ + System.out.print("+"); + } else { + System.out.print("-"); + } + } + } else { + for(int j=0;j<=2*n;j++){ + if(j%2==0){ + System.out.print("|"); + } else { + System.out.print(" "); + } + } + } System.out.println(""); + } + } +} \ No newline at end of file diff --git a/DEV2.1/TP0:Introduction/Somme.class b/DEV2.1/TP0:Introduction/Somme.class new file mode 100644 index 0000000..06a239d Binary files /dev/null and b/DEV2.1/TP0:Introduction/Somme.class differ diff --git a/DEV2.1/TP0:Introduction/Somme.java b/DEV2.1/TP0:Introduction/Somme.java new file mode 100644 index 0000000..498a956 --- /dev/null +++ b/DEV2.1/TP0:Introduction/Somme.java @@ -0,0 +1,10 @@ +public class Somme{ + + public static void main(String[] args) { + int resultat=0; + for(int i=0;i<args.length;i++){ + int n = Integer.parseInt(args[i]); + resultat=resultat+n; + } System.out.println("Le resultat est:"+" "+resultat); + } +} \ No newline at end of file diff --git a/DEV2.1/TP0:Introduction/Tri.class b/DEV2.1/TP0:Introduction/Tri.class new file mode 100644 index 0000000..19ea37d Binary files /dev/null and b/DEV2.1/TP0:Introduction/Tri.class differ diff --git a/DEV2.1/TP0:Introduction/Tri.java b/DEV2.1/TP0:Introduction/Tri.java new file mode 100644 index 0000000..f6a702d --- /dev/null +++ b/DEV2.1/TP0:Introduction/Tri.java @@ -0,0 +1,14 @@ +import java.util.Arrays; + +public class Tri{ + + public static void main(String[] args) { + int resultat=0; + for(int i=0;i<args.length;i++){ + int n = Integer.parseInt(args[i]); + } Arrays.sort(args); + for(int i=0;i<args.length;i++){ + System.out.println(args[i]); + } + } +} \ No newline at end of file diff --git a/DEV2.1/TP1:ComposantsGraphiques/Boutons.class b/DEV2.1/TP1:ComposantsGraphiques/Boutons.class new file mode 100644 index 0000000..6b67533 Binary files /dev/null and b/DEV2.1/TP1:ComposantsGraphiques/Boutons.class differ diff --git a/DEV2.1/TP1:ComposantsGraphiques/Boutons.java b/DEV2.1/TP1:ComposantsGraphiques/Boutons.java new file mode 100644 index 0000000..f73553a --- /dev/null +++ b/DEV2.1/TP1:ComposantsGraphiques/Boutons.java @@ -0,0 +1,24 @@ +import javax.swing.*; +import java.awt.*; + +public class Boutons { + public static void main(String[] args) { + JFrame fenetre = new JFrame(); + JPanel pan = new JPanel(); + fenetre.setSize(400, 200); + fenetre.setLocation(0, 0); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JButton bouton1 = new JButton(); + JButton bouton2 = new JButton(); + JButton bouton3 = new JButton(); + JButton bouton4 = new JButton(); + JButton bouton5 = new JButton(); + pan.add(bouton1); + pan.add(bouton2); + pan.add(bouton3); + pan.add(bouton4); + pan.add(bouton5); + fenetre.setContentPane(pan); + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP1:ComposantsGraphiques/Sirocco.class b/DEV2.1/TP1:ComposantsGraphiques/Sirocco.class new file mode 100644 index 0000000..2d0fb25 Binary files /dev/null and b/DEV2.1/TP1:ComposantsGraphiques/Sirocco.class differ diff --git a/DEV2.1/TP1:ComposantsGraphiques/Sirocco.java b/DEV2.1/TP1:ComposantsGraphiques/Sirocco.java new file mode 100644 index 0000000..3e94dc3 --- /dev/null +++ b/DEV2.1/TP1:ComposantsGraphiques/Sirocco.java @@ -0,0 +1,16 @@ +import javax.swing.*; +import java.awt.*; + +public class Sirocco { + public static void main(String[] args) { + JFrame fenetre = new JFrame(); + fenetre.setSize(500, 300); + fenetre.setLocation(0, 0); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JLabel etiquette = new JLabel("Sirocco"); + etiquette.setHorizontalAlignment(JLabel.RIGHT); + etiquette.setVerticalAlignment(JLabel.BOTTOM); + fenetre.add(etiquette, BorderLayout.CENTER); + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP2:ClassesEtObjets/Date.class b/DEV2.1/TP2:ClassesEtObjets/Date.class new file mode 100644 index 0000000..8599621 Binary files /dev/null and b/DEV2.1/TP2:ClassesEtObjets/Date.class differ diff --git a/DEV2.1/TP2:ClassesEtObjets/Date.java b/DEV2.1/TP2:ClassesEtObjets/Date.java new file mode 100644 index 0000000..be1ba28 --- /dev/null +++ b/DEV2.1/TP2:ClassesEtObjets/Date.java @@ -0,0 +1,98 @@ + +public class Date{ + + public int annee; + public int mois; + public int jour; + + public Date() { + this.annee=2023; + this.mois=02; + this.jour=13; + } + + public String toString() { + return (String.format("%04d",this.annee)+"/"+String.format("%02d",this.mois)+"/"+String.format("%02d",this.jour)); + } + + public Date lendemain(){ + Date res = new Date(); + if(this.mois==1||this.mois==3||this.mois==5||this.mois==7||this.mois==8||this.mois==10||this.mois>=12){ + if (this.jour>=31){ + res.jour=1; + if (this.mois==12){ + res.mois=1; + res.annee=this.annee+1; + }else{ + res.mois=this.mois+1; + res.annee=this.annee; + } + }else{ + res.jour=this.jour+1; + res.mois=this.mois; + res.annee=this.annee; + } + }else{ + if(this.mois==2){ + if (this.jour>=28){ + res.jour=1; + res.mois=this.mois+1; + res.annee=this.annee; + }else{ + res.jour=this.jour+1; + res.mois=this.mois; + res.annee=this.annee; + } + }else{ + if (this.jour>=30){ + res.jour=1; + res.mois=this.mois+1; + res.annee=this.annee; + }else{ + res.jour=this.jour+1; + res.mois=this.mois; + res.annee=this.annee; + } + } + } return res; + } + + public int datecmp(Date b){ + if (this.annee<b.annee){ + return -1; + }else if (this.annee>b.annee){ + return 1; + }else{ + if (this.mois<b.mois){ + return -1; + }else if (this.mois>b.mois){ + return 1; + }else{ + if (this.jour<b.jour){ + return -1; + }else if (this.jour>b.jour){ + return 1; + }else{ + return 0; + } + } + } + } + + public static void main(String[] args) { + Date d = new Date(); + Date l = d.lendemain(); + d.toString(); + l.toString(); + System.out.println("La date est:"+" "+d); + System.out.println("Le lendemain de "+d+" est:"+" "+l); + int cmp = d.datecmp(l); + if (cmp==-1){ + System.out.println("La date "+d+" est plus petite que la date "+l); + }else if (cmp==1){ + System.out.println("La date "+d+" est plus grande que la date "+l); + }else{ + System.out.println("La date "+d+" est egale a la date "+l); + } + } +} \ No newline at end of file diff --git a/DEV2.1/TP2:ClassesEtObjets/Periode.java b/DEV2.1/TP2:ClassesEtObjets/Periode.java new file mode 100644 index 0000000..41c699b --- /dev/null +++ b/DEV2.1/TP2:ClassesEtObjets/Periode.java @@ -0,0 +1,41 @@ + +public class Periode{ + + private int nbrjour; + private Date n; + private Date m; + + public Periode(Date a, Date b){ + this.n=a; + this.m=b; + this.nbrjour=((b.annee-a.annee)*365)+((b.mois-a.mois)*31)+(b.jour-a.jour); + } + + public String toString(){ + return System.out.println("L'intervalle entre "+this.n.toString+" et "+this.m.toString+" est de "+this.nbrjour+"jour(s)"); + } + + public void prolongePeriode(){ + this.m=this.m.lendemain; + this.nbrjour++; + } + + public int intervalle(){ + return this.nbrjour; + } + + public static void main(String[] args) { + Date d = new Date(); + Date l = d.lendemain(); + Periode p = new Periode(d,l); + Periode i = new Periode(d,l); + i.prolongePeriode(); + i.prolongePeriode(); + int n = p.intervalle(); + p.toString(); + i.toString(); + System.out.println(p); + System.out.println(i); + System.out.println(n); + } +} \ No newline at end of file diff --git a/DEV2.1/TP2:ClassesEtObjets/Progression.class b/DEV2.1/TP2:ClassesEtObjets/Progression.class new file mode 100644 index 0000000..f407e18 Binary files /dev/null and b/DEV2.1/TP2:ClassesEtObjets/Progression.class differ diff --git a/DEV2.1/TP2:ClassesEtObjets/Progression.java b/DEV2.1/TP2:ClassesEtObjets/Progression.java new file mode 100644 index 0000000..fa00c05 --- /dev/null +++ b/DEV2.1/TP2:ClassesEtObjets/Progression.java @@ -0,0 +1,26 @@ + +public class Progression{ + + // attribut + private int compte; + // methode + public void plusUn() { + this.compte++; + } + // autre methode + public String toString() { + return Integer.toBinaryString(this.compte); + } + + public static void main(String[] args) { + Progression n = new Progression(); + n.compte = 5; + int s=5; + for(int i = 0;i<5;i++){ + n.toString(); + System.out.println("L'ecriture binaire de "+s+" est: "+n); + n.plusUn(); + s++; + } + } +} \ No newline at end of file