push
This commit is contained in:
36
DEV2.1/CM1 (copy 1)/Exercice 2/Deduction.java
Normal file
36
DEV2.1/CM1 (copy 1)/Exercice 2/Deduction.java
Normal file
@@ -0,0 +1,36 @@
|
||||
//MELIANI SAMY (TP1)
|
||||
public class Deduction{
|
||||
public static void main(String[] args) {
|
||||
Deduction2 compte = new Deduction2();
|
||||
compte.voir();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.vider();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
compte.crediter();
|
||||
System.out.println(compte.toString());
|
||||
|
||||
Deduction3 compte2 = new Deduction3();
|
||||
compte2.crediter();
|
||||
compte2.crediter();
|
||||
compte2.crediter();
|
||||
compte2.crediter();
|
||||
compte2.crediter();
|
||||
compte2.crediter();
|
||||
compte2.crediter();
|
||||
compte2.crediter();
|
||||
compte2.crediter();
|
||||
System.out.println(compte2.toString());
|
||||
}
|
||||
}
|
||||
39
DEV2.1/CM1 (copy 1)/Exercice 2/Deduction2.java
Normal file
39
DEV2.1/CM1 (copy 1)/Exercice 2/Deduction2.java
Normal file
@@ -0,0 +1,39 @@
|
||||
//MELIANI SAMY (TP1)
|
||||
public class Deduction2{
|
||||
private int Limite, identifiant, Credit;
|
||||
private int Accumulation;
|
||||
public Deduction2(){
|
||||
Limite = 10;
|
||||
Accumulation=0;
|
||||
Credit = 0;
|
||||
identifiant = 253782;
|
||||
}
|
||||
public int voir(){
|
||||
return Credit;
|
||||
}
|
||||
public void crediter(){
|
||||
if (Credit < 10){
|
||||
Credit += 1;
|
||||
Accumulation += 1;
|
||||
}
|
||||
else{
|
||||
Credit = 1;
|
||||
Accumulation += 1;
|
||||
}
|
||||
}
|
||||
public void vider(){
|
||||
Credit = 0;
|
||||
}
|
||||
public String toString(){
|
||||
String str = "";
|
||||
str += "identifiant : " + identifiant + " ";
|
||||
str += "Crédits restants : " + Credit + " ";
|
||||
str += "Accumulation : " + Accumulation;
|
||||
if(Credit == 10){
|
||||
str+= " PLAT OFFERT ";
|
||||
}
|
||||
return str;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
30
DEV2.1/CM1 (copy 1)/Exercice 2/Deduction3.java
Normal file
30
DEV2.1/CM1 (copy 1)/Exercice 2/Deduction3.java
Normal file
@@ -0,0 +1,30 @@
|
||||
//MELIANI SAMY (TP1)
|
||||
public class Deduction3{
|
||||
private int Limite, identifiant, Credit;
|
||||
private int Accumulation;
|
||||
public Deduction3(){
|
||||
Limite = 10;
|
||||
Accumulation=0;
|
||||
Credit = 10;
|
||||
identifiant = 253782;
|
||||
}
|
||||
public int voir(){
|
||||
return Credit;
|
||||
}
|
||||
public void crediter(){
|
||||
Accumulation += 1;
|
||||
}
|
||||
public void vider(){
|
||||
Credit = 10;
|
||||
}
|
||||
public String toString(){
|
||||
String str = "";
|
||||
str += "YesCard USER ";
|
||||
str += "identifiant : " + identifiant + " ";
|
||||
str += "Crédits restants : " + Credit + " ";
|
||||
str += "Accumulation : " + Accumulation;
|
||||
str+= " PLAT OFFERT ";
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
BIN
DEV2.1/CM1 (copy 1)/Exercice1/Decapite.class
Normal file
BIN
DEV2.1/CM1 (copy 1)/Exercice1/Decapite.class
Normal file
Binary file not shown.
14
DEV2.1/CM1 (copy 1)/Exercice1/Decapite.java
Normal file
14
DEV2.1/CM1 (copy 1)/Exercice1/Decapite.java
Normal file
@@ -0,0 +1,14 @@
|
||||
import java.awt.*;
|
||||
//MELIANI SAMY (TP1)
|
||||
|
||||
public class Decapite{
|
||||
public static void main(String[] args) {
|
||||
boolean ihl1= GraphicsEnvironment.isHeadless();
|
||||
|
||||
GraphicsEnvironment ihl2 = new GraphicsEnvironment();
|
||||
boolean yes = ihl2.isHeadlessInstance();
|
||||
if(ihl1){
|
||||
System.out.println("oui");
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/CM1 (copy 1)/Exercice3/Directions.class
Normal file
BIN
DEV2.1/CM1 (copy 1)/Exercice3/Directions.class
Normal file
Binary file not shown.
29
DEV2.1/CM1 (copy 1)/Exercice3/Directions.java
Normal file
29
DEV2.1/CM1 (copy 1)/Exercice3/Directions.java
Normal file
@@ -0,0 +1,29 @@
|
||||
//MELIANI SAMY (TP1)
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class Directions {
|
||||
public static void main(String[] args) {
|
||||
// un objet pour servir de fenetre
|
||||
JFrame fenetre = new JFrame();
|
||||
// on configure la fenetre
|
||||
fenetre.setSize(800, 800);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout layout = new GridLayout(2, 2);
|
||||
|
||||
|
||||
fenetre.setLayout(layout);
|
||||
fenetre.add(new Button("◤"));
|
||||
fenetre.add(new Button("◥"));
|
||||
fenetre.add(new Button("◣"));
|
||||
fenetre.add(new Button("◢"));
|
||||
layout.setHgap(500);
|
||||
layout.setVgap(500);
|
||||
layout.setAlignment(100);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
18
DEV2.1/CM1 (copy 1)/Exercice4/Debut.java
Normal file
18
DEV2.1/CM1 (copy 1)/Exercice4/Debut.java
Normal file
@@ -0,0 +1,18 @@
|
||||
//MELIANI SAMY (TP1)
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class Debut {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame("");
|
||||
fenetre.setSize(650,650);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
Debut2 appel1 = new Debut2();
|
||||
Debut3 appel2 = new Debut3(appel1);
|
||||
fenetre.addMouseListener(appel2);
|
||||
fenetre.add(appel1);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
30
DEV2.1/CM1 (copy 1)/Exercice4/Debut2.java
Normal file
30
DEV2.1/CM1 (copy 1)/Exercice4/Debut2.java
Normal file
@@ -0,0 +1,30 @@
|
||||
//MELIANI SAMY (TP1)
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
public class Debut2 extends JComponent {
|
||||
private int rayon;
|
||||
public Debut2(){
|
||||
super();
|
||||
rayon = 60;
|
||||
}
|
||||
|
||||
public void getrayon(int radius){
|
||||
this.rayon=radius;
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics pinceau){
|
||||
Graphics secondPinceau=pinceau.create();
|
||||
if(this.isOpaque()){
|
||||
secondPinceau.setColor(this.getBackground());
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
secondPinceau.setColor(new Color(115,194,251));
|
||||
secondPinceau.fillRect(0,0,this.getWidth(),this.getHeight());
|
||||
secondPinceau.setColor(Color.YELLOW);
|
||||
secondPinceau.fillOval((this.getWidth()/2)-(this.rayon/2), (this.getHeight())-(this.rayon/2), this.rayon, this.rayon);
|
||||
}
|
||||
}
|
||||
23
DEV2.1/CM1 (copy 1)/Exercice4/Debut3.java
Normal file
23
DEV2.1/CM1 (copy 1)/Exercice4/Debut3.java
Normal file
@@ -0,0 +1,23 @@
|
||||
//MELIANI SAMY (TP1)
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class Debut3 implements MouseListener{
|
||||
private int rayon;
|
||||
private Debut2 ref;
|
||||
public Debut3(Debut2 appel){
|
||||
super();
|
||||
this.rayon=60;
|
||||
this.ref=appel;
|
||||
}
|
||||
public void mouseEntered(MouseEvent evenement){}
|
||||
public void mousePressed(MouseEvent evenement){}
|
||||
public void mouseReleased(MouseEvent evenement){}
|
||||
public void mouseExited(MouseEvent evenement){}
|
||||
public void mouseClicked(MouseEvent evenement){
|
||||
this.rayon+=20;
|
||||
ref.getrayon(this.rayon);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user