From df7f3f911b31c9e0ad509fb09ba2ed935fbd6b24 Mon Sep 17 00:00:00 2001 From: Simon Saye Babu Date: Mon, 13 Feb 2023 11:26:06 +0100 Subject: [PATCH] debut classe et objet --- DEV2.1/TP2/Compteur.class | Bin 0 -> 774 bytes DEV2.1/TP2/Compteur.java | 29 ++++++++++++++ DEV2.1/TP2/Date.class | Bin 0 -> 1083 bytes DEV2.1/TP2/Date.java | 79 ++++++++++++++++++++++++++++++++++++++ DEV2.1/TP2/Periode.java | 10 +++++ 5 files changed, 118 insertions(+) create mode 100644 DEV2.1/TP2/Compteur.class create mode 100644 DEV2.1/TP2/Compteur.java create mode 100644 DEV2.1/TP2/Date.class create mode 100644 DEV2.1/TP2/Date.java create mode 100644 DEV2.1/TP2/Periode.java diff --git a/DEV2.1/TP2/Compteur.class b/DEV2.1/TP2/Compteur.class new file mode 100644 index 0000000000000000000000000000000000000000..b6456a2297244ec36e917fdc392bdb7148fe62cb GIT binary patch literal 774 zcmZWm-A)rh6#izrbbr{E7TRI~6#-?tRjP@18ZRU$oJ#XSOx;3&CBC33gr_4-EBAa8Fu3%wiY^J6ud}By&&21dqY<8 z<6(O8IugjaYR;5#S0-UJ5U99~&awZ_Zw>uu(7LETBGbqZIbL%QXS<4_(3O7w?Q?&e z3DC8G-Hp?vA3O_{U|~12nI=1m+(7}04(8z)a2+(@(Zl70Y8DMN9o)q|2TQ0J*m2Op zeFtSM3Y4z=z3d$aeJN1BDzzgS41z?UDC4JLPpfh%v+k$(x~C^H7;!CeO4jPd zbQrf@aXFGafj{ChmNK>JvVbvGLql$<>dwkE_W6T4KNk?t)YF;i%=uWJ3%q%(YmByc z4&kkSh4v|%F7YfP$1_ia0ShJ(T*U;p&7NR)-aGgLO@A{5v@=SF!UYa-nG?`DqXL;8 zG2f8;$egRlL{z;@nJQ|N=|f5=Yg<2{ADHKu>of@~+3!*LjC}J9#u-co>%+g_%Cwd- h)iB4rMy6$&tz!)<*yOp)ss-&2ECbi-l&EKrmH#_pkxu{s literal 0 HcmV?d00001 diff --git a/DEV2.1/TP2/Compteur.java b/DEV2.1/TP2/Compteur.java new file mode 100644 index 0000000..8ba51e0 --- /dev/null +++ b/DEV2.1/TP2/Compteur.java @@ -0,0 +1,29 @@ +public class Compteur +{ + private int compte; + + public Compteur(int start) + { + this.compte = start; + } + + public void plusUn() + { + this.compte++; + } + + public String toString() + { + return Integer.toBinaryString(this.compte); + } + + public static void main(String[] args) + { + Compteur test = new Compteur(5); + while (test.compte<10) + { + System.out.println(test.toString()); + test.plusUn(); + } + } +} diff --git a/DEV2.1/TP2/Date.class b/DEV2.1/TP2/Date.class new file mode 100644 index 0000000000000000000000000000000000000000..b676e934b136182e19af37e1614d16eb1343edeb GIT binary patch literal 1083 zcmZ`%?M@Rx6g{(Dy6v*irBG1$@S|0?3rj`8FR&^aV-x&HYDkEGT*`(lw%ev`O-y_m z9>A!vC6UAj@I`zJB&YijE-gD;c{QC3bCxBHv)-j1(5@Wb3!!;SMYp`^T zASXjU0b8z%GAt$FB(SWZpc8i^i51+G*^-W1Se4nDhT8(_LA})!5GAIyx_>Az;s$}| z3B))2zz>T|tWv3z-zMNmeUF9ImLGU8TeV%U`NrL?@+4XHf<3S1`hmcdmESsWKe&ae z8|)X#Vbc%x*9FGPp<8+X!fo_g5@Eetle|&mwDoqlQPS#VO00O#{D|tQ8+yxqmwU72SNFW8fxEcJdpa_?Z{Q;41r%q6^v+7O$iZ^vc@66ZHt;}0 z(ZEAIGB78>W`FXl-2<-@3dAg_FYY!PyuZMlRT{o~kDnGe)*1I3I_l#G2+JQ2L$5}{ zdW*D~Zj)axyr#P$ee~QK2__?jr;i1+h6GjlYcgjE*v4f(hDkoL7!>IyGesI2t@MnhhN`xwHWZ$q)?+KAb+ZKz*)E-=eD%|{3%h)nX+F^*BP7_8FG-lWgu z6hwWpze6z>j!-zk$j&k1+^ZdE=|l%f=COfXQQvXbf&N7nOydaFf0`m-dXyt1dH~cd z7`+1dl>x;j)uypV{YBonLbVG-s8H4%YUQ)(Y2Rd*)NT(99*}uTa!)YPU2o!1XO>Kt z=ziDL=k!Yother.annee) + { + return 1; + } + else + { + if (this.mois>other.mois) + { + return 1; + } + else + { + if (this.jour>other.jour) + { + return 1; + } + else + { + return -1; + } + } + } + } + } + + + + public static void main(String[] args) + { + Date test = new Date(2023,12,30); + System.out.println(test.toString()); + System.out.println(test.lendemain()); + } +} diff --git a/DEV2.1/TP2/Periode.java b/DEV2.1/TP2/Periode.java new file mode 100644 index 0000000..a290d31 --- /dev/null +++ b/DEV2.1/TP2/Periode.java @@ -0,0 +1,10 @@ +public class Periode +{ + private int jour; + + public Periode(int j) + { + this.jour = j; + } + +}