BUT2/DEV/DEV2.1/TP01_Introduction/Q5_Grille.java
2023-10-23 13:23:36 +02:00

25 lines
575 B
Java

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