Ajout des TP

This commit is contained in:
stiti
2024-02-01 13:55:03 +01:00
parent 4fe273c309
commit 113583b37a
228 changed files with 7094 additions and 0 deletions

View 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 !");
}
}

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

View 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]);
}
}
}

Binary file not shown.

View 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("+-+-+");
}
}
}