From 9751315d1ae346178765ad57a6cad4f405dbfff4 Mon Sep 17 00:00:00 2001 From: Simon Saye Babu Date: Fri, 10 Feb 2023 11:52:05 +0100 Subject: [PATCH] java --- DEV2.1/TD1/Fraction.java | 39 ++++++++++++++++++++++++++++++++++++++ DEV2.1/TP1/Bonjour.class | Bin 0 -> 683 bytes DEV2.1/TP1/Bonjour.java | 19 +++++++++++++++++++ DEV2.1/TP1/Bonjour2.class | Bin 0 -> 713 bytes DEV2.1/TP1/Bonjour2.java | 21 ++++++++++++++++++++ DEV2.1/TP1/Bouton.class | Bin 0 -> 1004 bytes DEV2.1/TP1/Bouton.java | 35 ++++++++++++++++++++++++++++++++++ DEV2.1/TP1/Grille.class | Bin 0 -> 744 bytes DEV2.1/TP1/Grille.java | 29 ++++++++++++++++++++++++++++ DEV2.1/TP1/Saisie.class | Bin 0 -> 669 bytes DEV2.1/TP1/Saisie.java | 23 ++++++++++++++++++++++ DEV2.1/TP1/Sirocco.class | Bin 0 -> 696 bytes DEV2.1/TP1/Sirocco.java | 21 ++++++++++++++++++++ DEV2.1/TP1/Somme.class | Bin 0 -> 583 bytes DEV2.1/TP1/Somme.java | 14 ++++++++++++++ DEV2.1/TP1/Tri.class | Bin 0 -> 713 bytes DEV2.1/TP1/Tri.java | 23 ++++++++++++++++++++++ 17 files changed, 224 insertions(+) create mode 100644 DEV2.1/TD1/Fraction.java create mode 100644 DEV2.1/TP1/Bonjour.class create mode 100644 DEV2.1/TP1/Bonjour.java create mode 100644 DEV2.1/TP1/Bonjour2.class create mode 100644 DEV2.1/TP1/Bonjour2.java create mode 100644 DEV2.1/TP1/Bouton.class create mode 100644 DEV2.1/TP1/Bouton.java create mode 100644 DEV2.1/TP1/Grille.class create mode 100644 DEV2.1/TP1/Grille.java create mode 100644 DEV2.1/TP1/Saisie.class create mode 100644 DEV2.1/TP1/Saisie.java create mode 100644 DEV2.1/TP1/Sirocco.class create mode 100644 DEV2.1/TP1/Sirocco.java create mode 100644 DEV2.1/TP1/Somme.class create mode 100644 DEV2.1/TP1/Somme.java create mode 100644 DEV2.1/TP1/Tri.class create mode 100644 DEV2.1/TP1/Tri.java diff --git a/DEV2.1/TD1/Fraction.java b/DEV2.1/TD1/Fraction.java new file mode 100644 index 0000000..efc935e --- /dev/null +++ b/DEV2.1/TD1/Fraction.java @@ -0,0 +1,39 @@ +public class Fraction +{ + private int numerateur; + private int denominateur; + + public Fraction(int n, int d) + { + this.numerateur = n; + this.denominateur = d; + } + + private static int pgcd(int a, int b) + { + int pgdc=0; + for ( int i = 0 ; i <= a && i <= b ; i++ ) + { + if(a%i==0 && b%i==0) + { + pgcd = i; + } + } + return pgcd; + } + + public void reduire() + { + int pgcd = Fraction.pgcd(this.denominateur,this.numerateur); + this.denominateur/=pgcd; + this.numerateur/=pgcd; + } + + public + + public String toString() + { + return this.numerateur+"/"+this.denominateur; + } + +} \ No newline at end of file diff --git a/DEV2.1/TP1/Bonjour.class b/DEV2.1/TP1/Bonjour.class new file mode 100644 index 0000000000000000000000000000000000000000..1a3e1b2c5c759e1fee6f3e29e72d0422a515c3f7 GIT binary patch literal 683 zcmZuvO-~w86g_ul;0<)B2!hp0g{tiUB2Ck@iB=ajafKfVjY-qh176Hfm?3m9aqlnb zrfXeb(kA|ZuKQ!Uvb}F4X;fyCd+xhA=YGBS>*mKbfH$Zm@d)_@=J7;eAqf+C8;csB z+E~(9Na7im1&RVCLj1kwd*Kejbj!yC>qF2{gqeottAkO$rG_76tH%+mFFl`-cRx3} z@>JG)(m$y;!=dM&Y-wSt8OrvTeL0Bu0?!G_W-uDI)t;yI&Tim$`Mjak4jiNeRvfHi zjWB;dgfS!jpB?TQFhn{G zF}|xbs@L1*PGRXAYSqH)P3scIPne&sU}a)s#1||!8Np@@dyK@nN#Fne*2#@1c?K5y eGn_b$SB!6w;UCfgc5Ph4tapF2O4J5RM(uR-X)FFlf7lM#zP}L$s4?&R%r%k*>8#&&}aVYd( zad9LnaYpd6ZaW%&t)W&7Ytda-eoY_Di91SzKq1%$*3pdcf1!;#29fI zF;txo{*Zs-UdW??*GXa-4O%+U>ZnQF7Y9<4i~A}XlE2r~TpOz>GnBRc*&Clxiud{; z<|ARlLEXl#1{aNgIX>@+kfE@swq4Ve9@uDVYGo#apC#VDiUSe*{EM0-)KFVQiHL1@ zcxdAh_89Vi*j#UJ;EqE89tSR@^JPO_Jrqa)qRGDUpV=ZRF*@)~)s#78~}lXj@a z;`mg=i!H;M@hi^%XHuoiLlw(&6(u};8OlL4B5^cp9s~^aMVjuRtwyIRqRrM{rRECf z% zKM8 f^0by=VFSz9LJ@V+*(7~W>Bwg!h2c8!GFbZ!@35AQ literal 0 HcmV?d00001 diff --git a/DEV2.1/TP1/Bonjour2.java b/DEV2.1/TP1/Bonjour2.java new file mode 100644 index 0000000..9aa618d --- /dev/null +++ b/DEV2.1/TP1/Bonjour2.java @@ -0,0 +1,21 @@ +import javax.swing.*; +import java.awt.*; + +public class Bonjour2 { + public static void main(String[] args) { + // un objet pour servir de fenetre + JFrame fenetre = new JFrame(); + // on configure la fenetre + fenetre.setSize(500, 300); + fenetre.setLocation(0, 0); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + // un composant pour afficher du texte + JLabel etiquette = new JLabel("Bonjour !"); + // on configure l'etiquette + etiquette.setHorizontalAlignment(JLabel.CENTER); + // on ajoute le composant dans la fenetre, au milieu + fenetre.add(etiquette, BorderLayout.CENTER); + // et on montre le resultat + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP1/Bouton.class b/DEV2.1/TP1/Bouton.class new file mode 100644 index 0000000000000000000000000000000000000000..ee9ce6c7f3e0e35fbe19b12c745489857582295e GIT binary patch literal 1004 zcmZ`&$x;(h6g@BLiO>vbOe9VW4s=K$GC2?iNt6;Rh6PkCaMdACXe#NZx;vt{cjeNJ z{)L-RB~^Za-{acyzHU-Tm1c4Ky>srp@7(iVe*XUc1He4W2@GRQ#drcSjEQhtggYYK zRdG+lL;@;I5wa>KHRJ@9*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3O!}VYG28Zha literal 0 HcmV?d00001 diff --git a/DEV2.1/TP1/Saisie.java b/DEV2.1/TP1/Saisie.java new file mode 100644 index 0000000..2f17584 --- /dev/null +++ b/DEV2.1/TP1/Saisie.java @@ -0,0 +1,23 @@ +import javax.swing.*; +import java.awt.*; + +public class Saisie +{ + public static void main(String[] args) + { + JFrame fenetre = new JFrame(); + fenetre.setSize(500, 300); + fenetre.setLocation(0, 0); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JTextField txt = new JTextField(); + txt.setBounds(0,100,500,300); + fenetre.add(txt, BorderLayout.SOUTH); + + JTextArea txt2 = new JTextArea(); + txt2.setVerticalAlignment(JTextArea.CENTER); + fenetre.add(txt2, BorderLayout.CENTER); + + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP1/Sirocco.class b/DEV2.1/TP1/Sirocco.class new file mode 100644 index 0000000000000000000000000000000000000000..2d1fdc5c906ee62fd4d1777de9021f9a227d52c5 GIT binary patch literal 696 zcmZuvU2oGs5S)vhICWjp1QJr9lolvXZEC(AKt)IpR8eHwhoDG>r;Brhs~lf(918tc zyf_k-_yPPLo)LRVq#}eZ&F;d&Ws zHZ0uGux??ajGMZ2OT%poYZf*cN>61Xvu6y3+v+lyZPgbHl~5*Pe?07o^eykjv||pr zOc)yO`|yZ==0VJpLD0!knGAMxquo*CG!nZ~lbw!CRTQahO?6O3jiILVFTv=9I)c}` zDIW?4ci=i`Y1o4IFDK+Z5i?kGF|Fe}xT}fvsRw?N1usZSO=$8pw<)kqv1i*#Nx z-6_BB{(lG!>U^bAd8(3($IoLqNQNSzBMsi~GqmPy+IL$Gk5xj&oxh}J4rlWusjeK! z+3?+WtuEG4p$pef0Zb2-@FJ~NDKd)1tqIsSN*FE?mZqB~7Enina!vgNgI?gt848CJ z7@=2XzpBj7VS0v=1IM%IFNZ7pl0v{Ak! zO=>8TCX70}KzrXGPyu(@vJ|;_;!t@AUA}nDBuM}n# z$^yR;B~kWX;8fR71nyq{+z7@GqQo2yK6ys^Cj6p9M-0V-HfcpYF7OA5;YRo4woI!tR8~)>? ze*K8o%Xmqn;~lE!I#0_2HL#!_XX93z>nB)-$8p0B(H)H@*TZ@S9D6rtQxA)b1 zRqLy;S8FA45camx#OYR|y6>K=VWyY3CUITBZbjp`>pu(95>tC|u#qM^m_kls*})C0 zNZfR=idz!59o&H@vF4zHyCkAspm5%9x3lke6M^{)7zDI-Q(*R7-3$}I=f~_jRPo5C zE8uz;&@=6<$v6r6wI^|`4n`b!6vfOiy>>I5?=Otj!6@+u$+L<G=_>K?0de2edsE)C>Fj=N2-Oe<*3%2$X_JP2IkZe>B8G6&NZV?|T+1~-pj)xg;$|Gov>QZUy7_R&RGn4*KF|-V$&gLMu#>NI=as*i+lE?Tu@~F{&fC3(34lnujUemte j@5?i56~-w;Qes93i9%+9V=SK_PhW^*lsMXK)@|+&qIQcd literal 0 HcmV?d00001 diff --git a/DEV2.1/TP1/Tri.java b/DEV2.1/TP1/Tri.java new file mode 100644 index 0000000..3f36405 --- /dev/null +++ b/DEV2.1/TP1/Tri.java @@ -0,0 +1,23 @@ +import java.util.Arrays; + +public class Tri +{ + public static void main(String[] args) + { + int n = 0; + int j = 0; + int[] tabN = new int[args.length]; + for (String i : args ) + { + n = Integer.parseInt(i); + tabN[j] = n; + j++; + } + Arrays.sort(tabN); + + for (int i : tabN ) + { + System.out.print(i); + } + } +} \ No newline at end of file