Ajout des TP
This commit is contained in:
17
BUT1/DEV2.2/TP1-Introduction/EXO 1 /Bonjour.java
Normal file
17
BUT1/DEV2.2/TP1-Introduction/EXO 1 /Bonjour.java
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Cette classe est une simple coquille pour recevoir la méthode principale
|
||||
*
|
||||
* @version 1.1 09 March 2014
|
||||
* @author Luc Hernandez
|
||||
*/
|
||||
public class Bonjour {
|
||||
|
||||
/**
|
||||
* Affiche «Bonjour !»
|
||||
*
|
||||
* @param args la liste des arguments de la ligne de commande (inutilisée ici)
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Bonjour !");
|
||||
}
|
||||
}
|
33
BUT1/DEV2.2/TP1-Introduction/EXO 1 /exo1.java
Normal file
33
BUT1/DEV2.2/TP1-Introduction/EXO 1 /exo1.java
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Cette classe est une simple coquille pour recevoir la méthode principale
|
||||
*
|
||||
* @version 1.1 09 March 2014
|
||||
* @author Luc Hernandez
|
||||
*/
|
||||
public class exo1 {
|
||||
|
||||
/**
|
||||
* Affiche «Bonjour !»
|
||||
*
|
||||
* @param args la liste des arguments de la ligne de commande (inutilisée ici)
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
byte moncefleboss1 = 1;
|
||||
short moncefleboss2 = 1;
|
||||
int moncefleboss3 = 1;
|
||||
long moncefleboss4 = 1;
|
||||
boolean moncefleboss5 = false;
|
||||
char moncefleboss6 = 'Y';
|
||||
float moncefleboss7 = -1.5f;
|
||||
double moncefleboss8 = 47.0d;
|
||||
|
||||
System.out.println("Valeur : " + moncefleboss1);
|
||||
System.out.println("Valeur : " + moncefleboss2);
|
||||
System.out.println("Valeur : " + moncefleboss3);
|
||||
System.out.println("Valeur : " + moncefleboss4);
|
||||
System.out.println("Valeur : " + moncefleboss5);
|
||||
System.out.println("Valeur : " + moncefleboss6);
|
||||
System.out.println("Valeur : " + moncefleboss7);
|
||||
System.out.println("Valeur : " + moncefleboss8);
|
||||
}
|
||||
}
|
BIN
BUT1/DEV2.2/TP1-Introduction/EXO 2/Exo2.class
Normal file
BIN
BUT1/DEV2.2/TP1-Introduction/EXO 2/Exo2.class
Normal file
Binary file not shown.
14
BUT1/DEV2.2/TP1-Introduction/EXO 2/Exo2.java
Normal file
14
BUT1/DEV2.2/TP1-Introduction/EXO 2/Exo2.java
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Ici aussi il faut écrire des choses
|
||||
*/
|
||||
|
||||
public class Exo2 {
|
||||
/**
|
||||
* Ceci est une documentation
|
||||
*/
|
||||
public static void main(String[] args){
|
||||
for(String i : args){
|
||||
System.out.println("Bonjour " + i);
|
||||
}
|
||||
}
|
||||
}
|
BIN
BUT1/DEV2.2/TP1-Introduction/EXO 3/exo3.class
Normal file
BIN
BUT1/DEV2.2/TP1-Introduction/EXO 3/exo3.class
Normal file
Binary file not shown.
17
BUT1/DEV2.2/TP1-Introduction/EXO 3/exo3.java
Normal file
17
BUT1/DEV2.2/TP1-Introduction/EXO 3/exo3.java
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* DOC
|
||||
*/
|
||||
|
||||
public class exo3 {
|
||||
/**
|
||||
* DOC
|
||||
*/
|
||||
public static void main(String[] args){
|
||||
int resultat = 0;
|
||||
for(String i : args){
|
||||
int nombreTemporaire = Integer.parseInt(i);
|
||||
resultat += nombreTemporaire;
|
||||
}
|
||||
System.out.println("La somme est : " + resultat);
|
||||
}
|
||||
}
|
BIN
BUT1/DEV2.2/TP1-Introduction/EXO 4/exo4.class
Normal file
BIN
BUT1/DEV2.2/TP1-Introduction/EXO 4/exo4.class
Normal file
Binary file not shown.
24
BUT1/DEV2.2/TP1-Introduction/EXO 4/exo4.java
Normal file
24
BUT1/DEV2.2/TP1-Introduction/EXO 4/exo4.java
Normal file
@@ -0,0 +1,24 @@
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* DOC
|
||||
*/
|
||||
|
||||
public class exo4 {
|
||||
/**
|
||||
* DOC
|
||||
*/
|
||||
public static void main(String[] args){
|
||||
int[] tableauDeInt = new int[args.length];
|
||||
int index = 0;
|
||||
for(String valeur : args){
|
||||
int nombreTemporaire = Integer.parseInt(valeur);
|
||||
tableauDeInt[index] = nombreTemporaire;
|
||||
index++;
|
||||
}
|
||||
Arrays.sort(tableauDeInt);
|
||||
for(int j = 0; j<index;j++){
|
||||
System.out.println(tableauDeInt[j]);
|
||||
}
|
||||
}
|
||||
}
|
BIN
BUT1/DEV2.2/TP1-Introduction/EXO 5/exo5.class
Normal file
BIN
BUT1/DEV2.2/TP1-Introduction/EXO 5/exo5.class
Normal file
Binary file not shown.
26
BUT1/DEV2.2/TP1-Introduction/EXO 5/exo5.java
Normal file
26
BUT1/DEV2.2/TP1-Introduction/EXO 5/exo5.java
Normal file
@@ -0,0 +1,26 @@
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* DOC
|
||||
*/
|
||||
|
||||
public class exo5 {
|
||||
/**
|
||||
* DOC
|
||||
*/
|
||||
public static void main(String[] args){
|
||||
for(String tailleGrilleString : args){
|
||||
int tailleGrilleInt = Integer.parseInt(tailleGrilleString);
|
||||
if(tailleGrilleInt < 1){
|
||||
System.out.println("J'affiche quoi si la taille est de " + tailleGrilleInt + " ?");
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i<tailleGrilleInt;i++){
|
||||
System.out.println("+-+-+");
|
||||
System.out.println("| | |");
|
||||
}
|
||||
System.out.println("+-+-+");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user