controle 2

This commit is contained in:
2024-05-17 10:59:23 +02:00
parent 1ca75a01d0
commit 0f828b31cf
7 changed files with 14843 additions and 0 deletions

BIN
DEV2.1/CM2/Prototype.class Normal file

Binary file not shown.

49
DEV2.1/CM2/Prototype.java Normal file
View File

@@ -0,0 +1,49 @@
//Patrick Felix-Vimalaratnam
import java.io.File;
import java.io.IOException;
import java.io.FileOutputStream;
public class Prototype{
public static void main(String[] args) {
if (args.length == 0) {
System.err.println("Manque le nom du fichier");
System.exit(1);
}
String nom = new String();
for (int i=0; i<args.length; i++){
nom=nom+args[i];
}
File f = new File(nom);
try{
f.createNewFile();
try{
FileOutputStream ecrit = new FileOutputStream(f);
String chaine = new String();
String ouvrant =new String();
String fermant =new String();
String espace =new String();
chaine = "public class";
ouvrant = "{";
fermant = "}";
espace = " ";
ecrit.write(chaine.getBytes());
ecrit.write(espace.getBytes());
ecrit.write(nom.getBytes());
ecrit.write(espace.getBytes());
ecrit.write(ouvrant.getBytes());
ecrit.write(espace.getBytes());
ecrit.write(fermant.getBytes());
try{
ecrit.close();
}catch(IOException e){
System.err.println("Erreur fermeture");
}
}catch(IOException e){
System.err.println("Erreur ecriture");
}
}catch(IOException e){
System.err.println("Erreur d'ouverture");
}
}
}

4845
DEV2.1/CM2/Prudence.mdj Normal file

File diff suppressed because it is too large Load Diff

4196
DEV2.1/CM2/Puzzle.mdj Normal file

File diff suppressed because it is too large Load Diff

5711
DEV2.1/CM2/processus.mdj Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
//Patrick Felix-Vimalaratnam
import java.io.File
public class Prototype{
public static void main(String[] args) {
if (args.length == 0) {
System.err.println("Manque le nom du fichier");
System.exit(1);
}
String nom = new String();
for (int i=0; i<args.length; i++){
nom=nom+args[i];
File f = new File(nom);
f.createNewFile();
try{
FileOutputStream ecrit = new FileOutputStream(f);
String chaine = new String();
String ouvrant =new String();
String fermant =new String();
String fermant =new String();
chaine = "public class";
ouvrant = "{";
fermant = "}";
espace = " ";
ecrit.write(chaine.getBytes());
ecrit.write(espace.getBytes());
ecrit.write(nom.getBytes());
ecrit.write(espace.getBytes());
ecrit.write(ouvrant.getBytes());
ecrit.write(espace.getBytes());
ecrit.write(fermant.getBytes());
try{
ecrit.close();
}catch(IOException e){
System.err.println("Erreur fermeture");
}
}catch(IOException e){
System.err.println("Erreur ecriture");
}
}
}

BIN
DEV2.1/felix-vi_CM2.tar.gz Normal file

Binary file not shown.