Ajout des script pour les 4 questions de l'exo 1

This commit is contained in:
Daouadi Amir 2023-05-10 23:04:30 +02:00
parent 99f3594c74
commit dea0e7e14d
5 changed files with 45 additions and 0 deletions

View File

7
Exo 1/Question1.sce Normal file
View File

@ -0,0 +1,7 @@
data = csvRead("data/data.csv");
// surface terrestre mondiale
surface = sum(data(:, 2)* 1000);
// nombre d'habitants mondial
population = sum(data(:, 3)* 1000000);
// densité moyenne d'habitants au km2
densite = population / surface;

30
Exo 1/Question2.sce Normal file
View File

@ -0,0 +1,30 @@
data = csvRead("data/data.csv");
//Afrique
surfaceAfrique = sum(data(1:57, 2)* 1000);
populationAfrique = sum(data(1:57, 3)* 1000000);
densiteAfrique = populationAfrique / surfaceAfrique;
//Amérique du nord
surfaceAmeriqueNord = sum(data(58:86, 2)* 1000);
populationAmeriqueNord = sum(data(58:86, 3)* 1000000);
densiteAmeriqueNord = populationAmeriqueNord / surfaceAmeriqueNord;
//Amérique du sud
surfaceAmeriqueSud = sum(data(87:99, 2)* 1000);
populationAmeriqueSud = sum(data(87:99, 3)* 1000000);
densiteAmeriqueSud = populationAmeriqueSud / surfaceAmeriqueSud;
//Asie
surfaceAsie = sum(data(100:150, 2)* 1000);
populationAsie = sum(data(100:150, 3)* 1000000);
densiteAsie = populationAsie / surfaceAsie;
//Europe
surfaceEurope = sum(data(151:193, 2)* 1000);
populationEurope = sum(data(151:193, 3)* 1000000);
densiteEurope = populationEurope / surfaceEurope;
//Océanie
surfaceOceanie = sum(data(194:207, 2)* 1000);
populationOceanie = sum(data(194:207, 3)* 1000000);
densiteOceanie = populationOceanie / surfaceOceanie;

1
Exo 1/Question3.sce Normal file
View File

@ -0,0 +1 @@
bar([1, 2, 3, 4, 5, 6], [densiteAfrique, densiteAmeriqueNord, densiteAmeriqueSud, densiteAsie, densiteEurope, densiteOceanie]);

7
Exo 1/Question4.sce Normal file
View File

@ -0,0 +1,7 @@
//Surface
pie([surfaceAfrique, surfaceAmeriqueNord, surfaceAmeriqueSud, surfaceAsie, surfaceEurope, surfaceOceanie]);
legend(["Afrique", "Amérique du nord", "Amérique du sud", "Asie", "Europe", "Océanie"]);
//Population
pie([populationAfrique, populationAmeriqueNord, populationAmeriqueSud, populationAsie, populationEurope, populationOceanie]);
legend(["Afrique", "Amérique du nord", "Amérique du sud", "Asie", "Europe", "Océanie"]);