update
This commit is contained in:
BIN
DEV/DEV2.1/TP01_Introduction/Bonjour.class
Normal file
BIN
DEV/DEV2.1/TP01_Introduction/Bonjour.class
Normal file
Binary file not shown.
17
DEV/DEV2.1/TP01_Introduction/Bonjour.java
Normal file
17
DEV/DEV2.1/TP01_Introduction/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 !");
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/TP01_Introduction/Q2_Arguments.class
Normal file
BIN
DEV/DEV2.1/TP01_Introduction/Q2_Arguments.class
Normal file
Binary file not shown.
7
DEV/DEV2.1/TP01_Introduction/Q2_Arguments.java
Normal file
7
DEV/DEV2.1/TP01_Introduction/Q2_Arguments.java
Normal file
@@ -0,0 +1,7 @@
|
||||
public class Q2_Arguments{
|
||||
public static void main(String[] args) {
|
||||
for (String prenom : args){
|
||||
System.out.println("Bonjour " + prenom);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/TP01_Introduction/Q3_Somme.class
Normal file
BIN
DEV/DEV2.1/TP01_Introduction/Q3_Somme.class
Normal file
Binary file not shown.
25
DEV/DEV2.1/TP01_Introduction/Q3_Somme.java
Normal file
25
DEV/DEV2.1/TP01_Introduction/Q3_Somme.java
Normal file
@@ -0,0 +1,25 @@
|
||||
import java.util.Arrays;
|
||||
public class Q3_Somme{
|
||||
public static void main(String[] args) {
|
||||
int somme = 0;
|
||||
int entier;
|
||||
int index=0;
|
||||
int[] listeEntier = new int [args.length];
|
||||
|
||||
for (String argument : args){
|
||||
entier = Integer.parseInt(argument);
|
||||
listeEntier[index] = entier;
|
||||
somme += entier;
|
||||
index++;
|
||||
}
|
||||
|
||||
Arrays.sort(listeEntier);
|
||||
System.out.print("Tri :");
|
||||
for (int element : listeEntier){
|
||||
System.out.print(" " + element);
|
||||
}
|
||||
|
||||
System.out.println("");
|
||||
System.out.println("Somme : " + somme);
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/TP01_Introduction/Q5_Grille.class
Normal file
BIN
DEV/DEV2.1/TP01_Introduction/Q5_Grille.class
Normal file
Binary file not shown.
24
DEV/DEV2.1/TP01_Introduction/Q5_Grille.java
Normal file
24
DEV/DEV2.1/TP01_Introduction/Q5_Grille.java
Normal file
@@ -0,0 +1,24 @@
|
||||
public class Q5_Grille{
|
||||
public static void main(String[] args) {
|
||||
int dimensionX = 0;
|
||||
int dimensionY = 0;
|
||||
if (args.length > 1){
|
||||
dimensionX = Integer.parseInt(args[0]);
|
||||
dimensionY = Integer.parseInt(args[1]);
|
||||
}
|
||||
for (int y=0 ; y<dimensionY ; y++){
|
||||
for (int x=0 ; x<dimensionX ; x++){
|
||||
System.out.print("+-");
|
||||
}
|
||||
System.out.println("+");
|
||||
for (int x=0 ; x<dimensionX ; x++){
|
||||
System.out.print("| ");
|
||||
}
|
||||
System.out.println("|");
|
||||
}
|
||||
for (int x=0; x<dimensionX ; x++){
|
||||
System.out.print("+-");
|
||||
}
|
||||
System.out.println("+");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user