From d2341e4a24ddca58871b3dcecad9f9300b8ef597 Mon Sep 17 00:00:00 2001 From: sayebabu Date: Thu, 19 Oct 2023 12:29:39 +0200 Subject: [PATCH] tp dev liste c pas fini :/ --- DEV3.2/Listes/Luminance/src/forme.java | 15 +++++++++ DEV3.2/Listes/Luminance/src/main.java | 41 +++++++++++++++++++++++ DEV3.2/Listes/{ => test}/src/listes.java | 0 DEV3.2/Recursivité/build/appel.class | Bin 0 -> 580 bytes DEV3.2/Recursivité/src/appel.java | 20 +++++++++++ 5 files changed, 76 insertions(+) create mode 100644 DEV3.2/Listes/Luminance/src/forme.java create mode 100644 DEV3.2/Listes/Luminance/src/main.java rename DEV3.2/Listes/{ => test}/src/listes.java (100%) create mode 100644 DEV3.2/Recursivité/build/appel.class create mode 100644 DEV3.2/Recursivité/src/appel.java diff --git a/DEV3.2/Listes/Luminance/src/forme.java b/DEV3.2/Listes/Luminance/src/forme.java new file mode 100644 index 0000000..f7926e0 --- /dev/null +++ b/DEV3.2/Listes/Luminance/src/forme.java @@ -0,0 +1,15 @@ +import java.awt.*; + +public class forme { + public static void parallelogramme(Graphics g, int x, int y, Color c) + { + int [] xP = {x+0, x+50, x+100, x+50}; + int [] yP = {y+0, y+100, y+100, y+0}; + //Polygon p = new Polygon(); + g.setColor(Color.BLACK); + g.drawPolygon(xP,yP,4); + g.setColor(c); + g.fillPolygon(xP,yP,4); + } + +} diff --git a/DEV3.2/Listes/Luminance/src/main.java b/DEV3.2/Listes/Luminance/src/main.java new file mode 100644 index 0000000..0cff150 --- /dev/null +++ b/DEV3.2/Listes/Luminance/src/main.java @@ -0,0 +1,41 @@ +import java.awt.Color; +import java.awt.Graphics; +import java.util.ArrayList; +import java.util.List; +import javax.swing.*; +import java.util.Random; + +class main extends JPanel +{ + public void paintComponent(Graphics G) + { + Random rand = new Random(); + int x = 50; + int y = 50; + List couleur = new ArrayList (); + for (int i = 0; i < 10; i++) + { + couleur.add(i,new Color(rand.nextInt(255),rand.nextInt(255),rand.nextInt(255))); + } + + for (int i = 0; i < couleur.size(); i++) { + forme.parallelogramme(G, x, y, couleur.get(i)); + x+=60; + } + + //Polygon p = new Polygon(); + //g.fillPolygon(p); + } + public static void main( String args[] ) + { + JFrame frame = new JFrame(); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setBackground(Color.white); + frame.setSize(750, 250); + + main panel = new main(); + + frame.add(panel); + frame.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV3.2/Listes/src/listes.java b/DEV3.2/Listes/test/src/listes.java similarity index 100% rename from DEV3.2/Listes/src/listes.java rename to DEV3.2/Listes/test/src/listes.java diff --git a/DEV3.2/Recursivité/build/appel.class b/DEV3.2/Recursivité/build/appel.class new file mode 100644 index 0000000000000000000000000000000000000000..b6caefbd67a42eb31fb911f1647d995de444e49c GIT binary patch literal 580 zcmZuuNlU{(6#k}38=J=3#Wh-YCGEk2H&H|ogn%1Fdhs-kV~u7bO$GmtM=yF%@!${e zM~QDzp$IZCZyxh)^XBXO;}gIEHg)8nXiyF0QDCUt@_XL)dDv^8b#H~6G8Fc_&`b9j z6sy_MF@~ZB-9QNjL!QU6@EJ8PM8Yr@ z^Q14RWtg&#M*t^Hys)?1w2PR;l!j>oGnoAo&UxskBA`ssK(dEqFKV9?GbO&@!LAMy z^BNWmG_c4}&kX)z7_?Y2{BW4ML*+2KqBl$&d!aZT1YMC_@UDE-xRY}C?u5s`y&75r%21SMShnp42D0%Vn%GAxMgrMjufk)6A}nB37~XE3-{tnWWZI fw%;*M8hbCO&%a`BWIq(Dl6{SSvQEtP%w*#SKRRt& literal 0 HcmV?d00001 diff --git a/DEV3.2/Recursivité/src/appel.java b/DEV3.2/Recursivité/src/appel.java new file mode 100644 index 0000000..aa4437b --- /dev/null +++ b/DEV3.2/Recursivité/src/appel.java @@ -0,0 +1,20 @@ +public class appel { + + private static int factorielle(int x) + { + if( x > 1) + { + return x*factorielle(x-1); + } + else + { + return 1; + } + } + + public static void main(String[] args) { + + int y = factorielle(Integer.parseInt(args[0])); + System.out.println(y); + } +}