This commit is contained in:
Simon SAYE BABU 2023-03-27 11:21:24 +02:00
parent df7f3f911b
commit da8751e107
18 changed files with 218 additions and 8 deletions

View File

@ -68,12 +68,5 @@ public class Date
}
}
public static void main(String[] args)
{
Date test = new Date(2023,12,30);
System.out.println(test.toString());
System.out.println(test.lendemain());
}
}

9
DEV2.1/TP3/Feuille.java Normal file
View File

@ -0,0 +1,9 @@
Public class Feuille extends Paper
{
public Feuille()
{
super();
super.setSize(0.797167,1.168568);
super.setImageableArea(0.06,0.06,0.75,1.09);
}
}

34
DEV2.1/TP3/gris.java Normal file
View File

@ -0,0 +1,34 @@
Public class Gris extends Color
{
private float gr;
public Gris(gr)
{
super(gr,gr,gr);
}
getHeight()
{
}
getWidth()
{
}
getImageableHeight()
{
}
getImageableWidht()
{
}
getImageableX()
{
}
getImageableY()
{
}
}

BIN
DEV2.1/TP4/Chien.class Normal file

Binary file not shown.

23
DEV2.1/TP4/Chien.java Normal file
View File

@ -0,0 +1,23 @@
import javax.swing.*;
import java.awt.*;
public class Chien {
public static void main(String[] args) {
JFrame fenetre = new JFrame();
FlowLayout main = new FlowLayout(FlowLayout.CENTER);
fenetre.setLayout(main);
fenetre.setSize(500, 500);
fenetre.setLocation(0, 0);
JLabel question = new JLabel("Aimez-vous les chiens ?");
question.setHorizontalAlignment(JLabel.CENTER);
fenetre.add(question, BorderLayout.CENTER);
fenetre.add(new JButton("Oui"));
fenetre.add(new JButton("Non"));
fenetre.add(new JButton("NSPP"));
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setVisible(true);
}
}

BIN
DEV2.1/TP4/Damier.class Normal file

Binary file not shown.

34
DEV2.1/TP4/Damier.java Normal file
View File

@ -0,0 +1,34 @@
import javax.swing.*;
import java.awt.*;
public class Damier {
public static void main(String[] args) {
int taille = Integer.parseInt(args[0]);
JFrame fenetre = new JFrame();
fenetre.setSize(500, 500);
fenetre.setLocation(0, 0);
GridLayout main = new GridLayout(taille,taille);
fenetre.setLayout(main);
for (int i = 0;i<taille;i++)
{
for (int j = 0;j<taille;j++)
{
JPanel temp = new JPanel();
if ((i+j)%2==0)
{
temp.setBackground(Color.CYAN);
}
else
{
temp.setBackground(Color.WHITE);
}
fenetre.add(temp);
}
}
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setVisible(true);
}
}

BIN
DEV2.1/TP4/Moto.class Normal file

Binary file not shown.

9
DEV2.1/TP4/Moto.java Normal file
View File

@ -0,0 +1,9 @@
public class Moto implements Vehicule{
public int nbRoues=2;
public int nbRoues() {
return nbRoues;
}
public String sorte() {
return "Moto";
}
}

BIN
DEV2.1/TP4/Moyenne.class Normal file

Binary file not shown.

49
DEV2.1/TP4/Moyenne.java Normal file
View File

@ -0,0 +1,49 @@
public class Moyenne {
float value = 0;
int nbVal = 0;
public void add(int x)
{
value+=x;
nbVal++;
}
public void add(short x)
{
value+=x;
nbVal++;
}
public void add(long x)
{
value+=x;
nbVal++;
}
public void add(double x)
{
value+=x;
nbVal++;
}
public void add(byte x)
{
value+=x;
nbVal++;
}
public void add(float x)
{
value+=x;
nbVal++;
}
public float getAverage()
{
return value/nbVal ;
}
public static void main(String[] args) {
}
}

BIN
DEV2.1/TP4/Test.class Normal file

Binary file not shown.

24
DEV2.1/TP4/Test.java Normal file
View File

@ -0,0 +1,24 @@
import javax.swing.JOptionPane;
public class Test {
public static void main(String[] args) {
Vehicule v;
Object[] choix = {"Voiture", "Moto"};
int reponse = JOptionPane.showOptionDialog(null,
"Quel v\u00E9hicule choisissez-vous ?",
"Question",
JOptionPane.DEFAULT_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
choix,
null);
if (reponse == 0)
v = new Voiture();
else
v = new Moto();
System.out.println("Une "+v.sorte()+" poss\u00E8de "+v.nbRoues()+" roues.");
}
}

BIN
DEV2.1/TP4/Vehicule.class Normal file

Binary file not shown.

4
DEV2.1/TP4/Vehicule.java Normal file
View File

@ -0,0 +1,4 @@
public interface Vehicule{
public int nbRoues();
public String sorte();
}

BIN
DEV2.1/TP4/Voiture.class Normal file

Binary file not shown.

9
DEV2.1/TP4/Voiture.java Normal file
View File

@ -0,0 +1,9 @@
public class Voiture implements Vehicule{
public int nbRoues=4;
public int nbRoues() {
return nbRoues;
}
public String sorte() {
return "Voiture";
}
}

22
DEV2.1/TP4/formes.java Normal file
View File

@ -0,0 +1,22 @@
import javax.swing.*;
import java.awt.*;
public class formes extends JComponent{
public void horloge(Graphics pinceau)
{
}
public static void main(String[] args) {
DisplayGraphics m = new DisplayGraphics();
JFrame fenetre = new JFrame();
fenetre.add(m);
fenetre.setSize(1000, 1000);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setVisible(true);
}
}