Transférer les fichiers vers 'APL1.2/Dev1.2'

This commit is contained in:
Vieira Enzo 2022-02-07 07:10:26 +01:00
parent 48c5413097
commit 04e6feb86f
5 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,7 @@
public class Arguments {
public static void main(String[] args) {
for(int i = 0; i < args.length; i++) {
System.out.println("Salut " + args[i]);
}
}
}

View File

@ -0,0 +1,20 @@
public class Demarrage {
public static void main(String[] args) {
byte premier = 123;
short deuxieme = 124;
int troisieme = -125;
long quatre = 126L;
boolean cinq = true;
char six = 'o';
float sept = 13.5f;
double huit = 50.0d;
System.out.println(premier);
System.out.println(deuxieme);
System.out.println(troisieme);
System.out.println(quatre);
System.out.println(cinq);
System.out.println(six);
System.out.println(sept);
System.out.println(huit);
}
}

9
APL1.2/Dev1.2/Somme.java Normal file
View File

@ -0,0 +1,9 @@
public class Somme {
public static void main(String[] args) {
int total = 0;
for(int i = 0; i < args.length; i++) {
total = total + Integer.parseInt(args[i]);;
}
System.out.print("La somme totale est : " + total);
}
}

14
APL1.2/Dev1.2/Tri.java Normal file
View File

@ -0,0 +1,14 @@
import java.util.Arrays;
public class Tri {
public static void main(String[] args) {
int[] total = null;
total = new int[args.length];
for(int i = 0; i < args.length; i++) {
total[i] = Integer.parseInt(args[i]);
}
Arrays.sort(total);
for(int i = 0; i < args.length; i++) {
System.out.println(total[i]);
}
}
}

22
APL1.2/Dev1.2/grille.java Normal file
View File

@ -0,0 +1,22 @@
public class grille {
public static void main(String[] args) {
for(int j = 0; j < Integer.parseInt(args[0]); j++) {
System.out.print("+");
for(int i = 0; i < Integer.parseInt(args[0]); i++) {
System.out.print("-+");
}
System.out.print("\n|");
for(int i = 0; i < Integer.parseInt(args[0]); i++) {
System.out.print(" |");
}
System.out.print("\n");
}
System.out.print("+");
for(int i = 0; i < Integer.parseInt(args[0]); i++) {
System.out.print("-+");
}
}
}