tp dev liste c pas fini :/

This commit is contained in:
Simon SAYE BABU 2023-10-19 12:29:39 +02:00
parent a7d3b4e407
commit d2341e4a24
5 changed files with 76 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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<Color> couleur = new ArrayList<Color> ();
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);
}
}

Binary file not shown.

View File

@ -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);
}
}