CCB Premier Import
This commit is contained in:
30
03-SOURCES/Cercle.java
Normal file
30
03-SOURCES/Cercle.java
Normal file
@@ -0,0 +1,30 @@
|
||||
class Cercle
|
||||
{ class Centre // d<>finition interne a Cercle
|
||||
{ public Centre (int x, int y)
|
||||
{ this.x = x ; this.y = y ;
|
||||
}
|
||||
public void affiche()
|
||||
{ System.out.println (x + ", " + y) ;
|
||||
}
|
||||
class CentreCentre {
|
||||
|
||||
}
|
||||
private int x, y ;
|
||||
}
|
||||
public Cercle (int x, int y, double r)
|
||||
{ c = new Centre (x, y) ;
|
||||
this.r = r ;
|
||||
}
|
||||
public void affiche ()
|
||||
{ System.out.print ("cercle de rayon " + r + " de centre ") ;
|
||||
c.affiche() ;
|
||||
}
|
||||
public void deplace (int dx, int dy)
|
||||
{ c.x += dx ; c.y += dy ; // ici, on a bien acces <20> x et y
|
||||
}
|
||||
private Centre c ;
|
||||
private double r ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
15
03-SOURCES/ExPaquetageExistant.java
Normal file
15
03-SOURCES/ExPaquetageExistant.java
Normal file
@@ -0,0 +1,15 @@
|
||||
import java.io.*;
|
||||
|
||||
class ExPaquetageExistant {
|
||||
public static void main (String arg[]) {
|
||||
System.out.println ("Affichage du dossier ");
|
||||
File f = new File (".");
|
||||
String dossier [] = f.list ();
|
||||
|
||||
// enhanced for loop
|
||||
for (String s : dossier) {
|
||||
System.out.println ("-- " + s);
|
||||
}
|
||||
System.out.println ("2 puissance 3 = " + Math.pow (2,3));
|
||||
}
|
||||
}
|
||||
7
03-SOURCES/ExSousPaquetages.java
Normal file
7
03-SOURCES/ExSousPaquetages.java
Normal file
@@ -0,0 +1,7 @@
|
||||
import java.awt.event.*;
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
public class ExSousPaquetages {
|
||||
ActionEvent e ;
|
||||
}
|
||||
41
03-SOURCES/Point.java
Normal file
41
03-SOURCES/Point.java
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
public class Point {
|
||||
|
||||
private double x ;
|
||||
private double y ;
|
||||
|
||||
Point (double x, double y) {
|
||||
this.x = x ;
|
||||
this.y = y ;
|
||||
}
|
||||
|
||||
public boolean coincide (Point pt) {
|
||||
return ((pt.x == x) && (pt.y==y));
|
||||
}
|
||||
|
||||
public static void main (String args []) {
|
||||
Point p1 = new Point (1, 3);
|
||||
Point p2 = new Point (2, 9);
|
||||
Point p3 = new Point (1, 3);
|
||||
|
||||
System.out.println ("p1 et p2 " + p1.coincide(p2)); // <20>quivalent <20> p2.coincide (p1)
|
||||
System.out.println ("p1 et p3 " + p1.coincide(p3));
|
||||
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(double x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
27
03-SOURCES/Tableaux.java
Normal file
27
03-SOURCES/Tableaux.java
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
public class Tableaux {
|
||||
|
||||
//--------------------------------------------------------
|
||||
public static void main(String[] args) {
|
||||
int tab [] = {1, 2, 3, 4};
|
||||
int nb = 4 ;
|
||||
|
||||
// Afficher avant incr<63>mentation
|
||||
for (int val : tab)
|
||||
System.out.print (val + "\t");
|
||||
|
||||
// Incr<63>menter les cases du tableau
|
||||
incremente (tab, nb, 2);
|
||||
|
||||
// Afficher apr<70>s incr<63>mentation
|
||||
System.out.println();
|
||||
for (int val : tab)
|
||||
System.out.print (val + "\t");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
public static void incremente (int t [], int n, int inc) {
|
||||
for (int i = 0; i < n; i++)
|
||||
t[i] += inc ;
|
||||
}
|
||||
}
|
||||
9
03-SOURCES/TesteCercle.java
Normal file
9
03-SOURCES/TesteCercle.java
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
public class TesteCercle {
|
||||
public static void main (String args[])
|
||||
{ Cercle c1 = new Cercle(1, 3, 2.5) ;
|
||||
c1.affiche() ;
|
||||
c1.deplace (4, -2) ;
|
||||
c1.affiche() ;
|
||||
}
|
||||
}
|
||||
22
03-SOURCES/gestionStocks/C1.java
Normal file
22
03-SOURCES/gestionStocks/C1.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package gestionStocks;
|
||||
|
||||
public class C1 {
|
||||
|
||||
private int a ;
|
||||
private float b ;
|
||||
|
||||
public int getA() {
|
||||
return a;
|
||||
}
|
||||
public void setA(int a) {
|
||||
if (a > 0)
|
||||
this.a = a;
|
||||
}
|
||||
public float getB() {
|
||||
return b;
|
||||
}
|
||||
public void setB(float b) {
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
}
|
||||
18
03-SOURCES/gestionStocks/Stock.java
Normal file
18
03-SOURCES/gestionStocks/Stock.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package gestionStocks;
|
||||
import p1.* ;
|
||||
import p1.Article;
|
||||
import p2.* ;
|
||||
|
||||
|
||||
public class Stock {
|
||||
|
||||
Article a ;
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
13
03-SOURCES/ingredients/MaClasse.java
Normal file
13
03-SOURCES/ingredients/MaClasse.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package ingredients ;
|
||||
|
||||
public class MaClasse {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
12
03-SOURCES/modele/eleves/Promotion.java
Normal file
12
03-SOURCES/modele/eleves/Promotion.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package modele.eleves ;
|
||||
public class Promotion {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
13
03-SOURCES/p1/Article.java
Normal file
13
03-SOURCES/p1/Article.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package p1;
|
||||
|
||||
public class Article {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
13
03-SOURCES/p2/Article.java
Normal file
13
03-SOURCES/p2/Article.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package p2;
|
||||
|
||||
public class Article {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
13
03-SOURCES/paquetage1/Classe1.java
Normal file
13
03-SOURCES/paquetage1/Classe1.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package paquetage1;
|
||||
|
||||
public class Classe1 {
|
||||
|
||||
// Normalement on commence plutot par les attributs public !
|
||||
private int d11 ;
|
||||
public int d12 ;
|
||||
int d13;
|
||||
|
||||
private void m11 () {};
|
||||
public void m12 () {} ;
|
||||
void m13 () {};
|
||||
}
|
||||
8
03-SOURCES/paquetage1/Classe2.java
Normal file
8
03-SOURCES/paquetage1/Classe2.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package paquetage1;
|
||||
|
||||
public class Classe2 {
|
||||
|
||||
public void m21 () {};
|
||||
public void m22 () {};
|
||||
|
||||
}
|
||||
9
03-SOURCES/paquetage2/Classe3.java
Normal file
9
03-SOURCES/paquetage2/Classe3.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package paquetage2;
|
||||
|
||||
public class Classe3 {
|
||||
void m31() {};
|
||||
void m32() {};
|
||||
void m33() {};
|
||||
void m34() {};
|
||||
|
||||
}
|
||||
6
03-SOURCES/paquetage2/Classe4.java
Normal file
6
03-SOURCES/paquetage2/Classe4.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package paquetage2;
|
||||
|
||||
public class Classe4 {
|
||||
void m41() {};
|
||||
void m42() {};
|
||||
}
|
||||
13
03-SOURCES/promotion/Notes.java
Normal file
13
03-SOURCES/promotion/Notes.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package promotion;
|
||||
|
||||
public class Notes {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user