From 3e5709c01dda9ddfaec94db81d023d26368d873e Mon Sep 17 00:00:00 2001 From: pourchot Date: Mon, 13 Feb 2023 11:29:17 +0100 Subject: [PATCH] 13 Fevrier --- DEV2.1/TP0:Introduction/Arguments.class | Bin 0 -> 922 bytes DEV2.1/TP0:Introduction/Arguments.java | 19 ++++ DEV2.1/TP0:Introduction/Demarrage.class | Bin 0 -> 421 bytes DEV2.1/TP0:Introduction/Demarrage.java | 17 +++ DEV2.1/TP0:Introduction/Grille.class | Bin 0 -> 738 bytes DEV2.1/TP0:Introduction/Grille.java | 24 +++++ DEV2.1/TP0:Introduction/Somme.class | Bin 0 -> 996 bytes DEV2.1/TP0:Introduction/Somme.java | 10 ++ DEV2.1/TP0:Introduction/Tri.class | Bin 0 -> 635 bytes DEV2.1/TP0:Introduction/Tri.java | 14 +++ DEV2.1/TP1:ComposantsGraphiques/Boutons.class | Bin 0 -> 866 bytes DEV2.1/TP1:ComposantsGraphiques/Boutons.java | 24 +++++ DEV2.1/TP1:ComposantsGraphiques/Sirocco.class | Bin 0 -> 739 bytes DEV2.1/TP1:ComposantsGraphiques/Sirocco.java | 16 +++ DEV2.1/TP2:ClassesEtObjets/Date.class | Bin 0 -> 2529 bytes DEV2.1/TP2:ClassesEtObjets/Date.java | 98 ++++++++++++++++++ DEV2.1/TP2:ClassesEtObjets/Periode.java | 41 ++++++++ DEV2.1/TP2:ClassesEtObjets/Progression.class | Bin 0 -> 1266 bytes DEV2.1/TP2:ClassesEtObjets/Progression.java | 26 +++++ 19 files changed, 289 insertions(+) create mode 100644 DEV2.1/TP0:Introduction/Arguments.class create mode 100644 DEV2.1/TP0:Introduction/Arguments.java create mode 100644 DEV2.1/TP0:Introduction/Demarrage.class create mode 100644 DEV2.1/TP0:Introduction/Demarrage.java create mode 100644 DEV2.1/TP0:Introduction/Grille.class create mode 100644 DEV2.1/TP0:Introduction/Grille.java create mode 100644 DEV2.1/TP0:Introduction/Somme.class create mode 100644 DEV2.1/TP0:Introduction/Somme.java create mode 100644 DEV2.1/TP0:Introduction/Tri.class create mode 100644 DEV2.1/TP0:Introduction/Tri.java create mode 100644 DEV2.1/TP1:ComposantsGraphiques/Boutons.class create mode 100644 DEV2.1/TP1:ComposantsGraphiques/Boutons.java create mode 100644 DEV2.1/TP1:ComposantsGraphiques/Sirocco.class create mode 100644 DEV2.1/TP1:ComposantsGraphiques/Sirocco.java create mode 100644 DEV2.1/TP2:ClassesEtObjets/Date.class create mode 100644 DEV2.1/TP2:ClassesEtObjets/Date.java create mode 100644 DEV2.1/TP2:ClassesEtObjets/Periode.java create mode 100644 DEV2.1/TP2:ClassesEtObjets/Progression.class create mode 100644 DEV2.1/TP2:ClassesEtObjets/Progression.java diff --git a/DEV2.1/TP0:Introduction/Arguments.class b/DEV2.1/TP0:Introduction/Arguments.class new file mode 100644 index 0000000000000000000000000000000000000000..cbb6fc58373317378b865a288c23f683bb5242cd GIT binary patch literal 922 zcmaJRKQAG!O{w-CGp^e#>A2|now;*QxBd7n9zmY8L~Sx;qH&{ z?8UPlH0hx~z<=UjFh+d~#6lo$vh&`2^S<}K_h!ETzP6}q zY#F%65IwS`t)DZ5OXUlONL_UVL!x0z@p|aCgm=zc4j~bj+mazude`XjD_(WD>{grF zvt_py5Z9WTxBI7jFpW2xYUs7ai5-yFUwGZ2E2Q=h1F{7JF#|aZ+t^`99xJ7N?eW2> z(3h&?C!*Mm;l71D3I-ln*h7&a{x1npZZ*7V^+a3GLCuk`g-b1|AswVAf^AhjBej|| z3+~oT?Bjr8^;pRsDb2Hdfg$VizNjnN=K8IzFUj*YC)ErGr6p}ILJXT@W%I=tj6qP^ zp#i3sCAu*1FzEIXL-DpVTVAQYm=1ZO>V&to@JJAD)+;H6S9iGY3zGU_ zw!$>WWUw!}>^Q`LVu*k^JWOj@I3(4df2SmXzxX9yFSDB+`A<>n)@ zUl6L~o?a7-uZX;7?9-ngL5k2gMG6t}6I3aQ4B2g@utrE6pAz!Y?BD4#e<5cqC&)rr%heLhGtV@BKTN(Q1IXb z_)y{`f~DXdW@f+n&Fsv6eSdrcIL6RH3mqFC)+}@#^svs+=NK@wPLx)~DMQ0QxMMKS zvj@r0nJ6u<$~2Pst%zo%n5j^jVc_3S67eL0nb2_%7P->#xGHqQtjwqKQdMyKLZ%|m zMJ$gh*ae5hvEgD9TMYJDrW2y~MjYENcCbs@Uj>7=c;GrpQlkGm zjmm->8l|9tq)5jMy}HM;%)sXrG^0KG{(oy=geLt|bqo*=i>ytzA$dl=dH4?YLIEvI mwpELqkQKNTSLl9S3fQkOx{WuO3*4a;(4np#!K)M-X#W7L!c}Gf literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..249137e8c5a5e79341fcb8aad26bd2123a770d4e GIT binary patch literal 738 zcmZ`%%Wl&^6g}6DGmhh?FOmX{=>yuP2_%RGLTaf5NT8wum4euGH3_5CspACK;UTf? zFR)?DB5PO_#DWjtANU6LRe9WT5K*Pp(#+g*ea_r-ujc#juipUNM9qPVf`b{H&)@O%MaD#ey5?Lr?L@n zCe@LCNGOzcw%YQgtOYV`)#`ENhpja&9IMB&x%Wu+{_&l9w;wgteP4^S45MWw z8Ik-CLM$N5-RRE%4-7fp#~FEia-*=ypFtlvU~9amlO!R7NlbC9sXt*N#pmm?dE*O= zb@O)7n%(_?cG2p+N7dZ$61eDTnEM2CDs>2JfUFMF93Gf7`150c$|+PaqT2tdT9`S6 zb6~LWopxs=?(QbL3Bi6QV4=W%=NK))#&tNj#rO`l_>g^XGh>H)XfpPZ#|zfH;wL)I ew|U6^LWbxVIhqkiu#98SFgoHH5zZwg^M3)pG?Z!p literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..06a239dc2820b2be73a82fa45687ac56963900a7 GIT binary patch literal 996 zcmaJ=%Wl(95IvKZTjP=@eLzW4Qb=hUpn>vOkkAE@szyoyDOFjp;WoKy-S`pNHn#8R50 zD>`l5JGEE#-RW8XobO8?M{wbqPk@aimwXgzrmM_F=RwgB<+{>r3-WJJY;QP1qWL z2^-hCP~w6g;Eyq`35e$n7$jj9@4S2Ox#yny=I5UuX8>NI62M0xKoJuGCNY)6G-d+K z;-Qa6KIR0n8#>a-mVjG%ekkC*iQg-M@f{thyPiBZ2A4yPb~wAZuM2 zwQKdn=%~GJ8%OJjY#r^&{tZ8<$3xRnZ?$b6X&C*&wuKl$&POT4JQjQ`hIou6A5TIo zW5vhQ5M?~07xD%2w}bYZ9o0$%3b(24C{b-?DBhQ5pco2FRqipj{ZDC_=x*(`G4go8 zeFm{%$K8Fd$E5rGH@tp4NK}um;-Q^!JwnH|11_KN36$)u3rwWe?xqF&z9n_}a`$>W z#1gXnMfP*RU6A7$Fq$U{Vy5~X;tMYV4|rzNq)S?eQQj@}BV2gIm+pqUS*o6$AYU!5 zox<7ry{IbBvbBSS7A;Hk%Ec>FKlh&Zj{)SW4DkO z_ym51mqa2G&xmi}TM)BJswxteJZE<1%awj|X+5pxVh z>3_02=Tu?u??${$#L3`m9(XMSCdvjjq_I$8n42ivNn+ZWq0$u2Nz?H~a^gB&?kB=^ zPIz+WeippzyGhsQiA#T%B8hBa)4&#N1NU&>zymyF(8gUd%w9@5JZ^eUOv#QH*F~3l zOq+XqQeloFwb0?QkmoPa>ZSLQC#|^J3OnB6sTYk?syXD(oByAb!d;hPW1QvZv0V+@ zr(xg)@pgGsG8tr;p~I?S5EDhth+%P}I*93Ryl8X}L_HE6F}gJKUHJ%Wn5Fk3zZ7WX zm?L|IRx5;zFul|wZiP4}De4rYioyz>A6 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..2d0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!}k9v;F8UzpO+8tLqf_U_rqHu3|b+Dv@M;Mh#eGD}a4 z|6jxBc~(Qdfln2PmmF`6Bas?MB}c7sBqBN9XS7*Odkk&7pWw7k@HWY0Px52)G$Tkb zp(%dlID=7~Bj-F$@#8Xy3%EomLf7GMGsF*Peu&c5C-a&EsFGW#4Pfj!+GYs0&5sE1 zBidu@d>?p@?czSN4t}E{5+l1~qR;aL9WK37(plj?b(7fT5`(T#x5ULutj{RL=;oNw zRT{s>HqJBR>ukjWzi8dSINN#=x41iRv$=QKTvKMW4c@o7$Y$_Q=`@&0MA{ujhG&2o fF5*7Y9EU^1hqy|{NINXygoLLhJR{**3D5ll%s(}0 literal 0 HcmV?d00001 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.anneeb.annee){ + return 1; + }else{ + if (this.moisb.mois){ + return 1; + }else{ + if (this.jourb.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 0000000000000000000000000000000000000000..f407e1854959edf43923141122756794593e5b57 GIT binary patch literal 1266 zcmaJ=TTc^F5dKbEy32NvJIK{?lhPvf1}X(qnh={5B`HdXFP^q1u(aLN?4FYJ9sh&R zzWAy}!C>MK@K5+Zd_ZU0nwHS`uybbSd^7W%nc1Hg=RW|f;HiNSMmrI}n1OLjXqYs} z81=-BPJ}VlN4PlyH!<(|A{rJLf;m|#E5X20WUN`Xr8XG+k%d_%^HiNEYMmd&!z%US5NFVWI9xrnHAYS(-C`XA~1RRRIzIyA`=*lRb zD{S*}Beju{6(=XQEU!+_jw25o;kuTzm%QXAuA$q6i7pLM6EQ3@gjzr*`Z1v4mWd_A zDSlH*CdAB==+dA%;xQlxl?weS~iitjS6ShhIMfOPK6hm**m9mvM5DvpN zB{wabJJo;h9*m^gKD;Ggrs^tDqOQscWgVYSoHf|n8o9^fIvWO`oY97|Ok z5zbN_i_W|Vv#@a0YM3z$mv})WrJdty&r*k^xr*D$Wtfhn(k-n>v}M&_d(!3F3|iS^ zQlvQzM%s-@!y~U{>kPBamRR<&EQrRW>x{N|PD!V#;W6zQ8MpIA;m+0r6IY3}crFF*R?DIdymjO1BfZp_yTXf!q*HiC_kXXKqrA{`5QrDI=%dQlw!WY|B-ZBXp;33CgBG$)Ih(b5&^nf z`HsN;89LH2ovP^T{*4L!J*H!)2=0A`HXb{tQaD8?d5jYuJMps*e|~vve6`$B;sGM9 zlhsvwLO<0Qz!=qvkhX|n#EIoHMo0r;d>81|5Mb;#W{AY~TB;GO(P