Correction Etude de Cas 2013
Correction Etude de Cas 2013
Dossier 1
MLD
Garagistre(Numcontrat,RS,ville)
Entretien(Numero,date,kilometrage,#numcontrat,#codetypeentretien ,#Numimat)
Vehicule(NumImat,pv,carburant,modele)
Typevehicule(codecategorie,categorie)
Typevehicule(codetype,typevehicule)
Partie c++
#include<iostream.h>
#include<conio.h>
class entretien
{int numimat;
char *type;
public:
entretien(){numimat=55123;type="peugeot308";}
void affiche(){cout<<numimat<<"----"<<type<<endl;}
void fixe(int a,char *b){numimat=a;type=b;}
};
class reparation:public entretien
{char *ref,*desig;
public:
reparation();
void affiche();
char* getpiece();
};
reparation::reparation():entretien()
{ref="ax60k";desig="bougie";}
void reparation::affiche()
{entretien::affiche();
cout<<ref<<"----"<<desig<<endl;}
char* reparation:: getpiece(){return ref;}
void main()
{reparation a;
a.affiche();
cout<<"REF="<<a.getpiece();
getch();
}
Dossier 2
1- LAN : distance de quelques mètres à quelques Km
WAN : distance de quelques dizaines de Km à quelques 100Km
3.1) 5 pts
<?php
?>
3.2) 12 pts
<?php
include "connexion.php";
if(!isset($_GET['liste_cat'])){
$ln = mysql_fetch_array($res);
$idcat = $ln['idcat'];
mysql_data_seek($res,0);
</td>";
while($ln = mysql_fetch_array($res))
{ if($idcat==$ln['idcat'])
</td></form></tr>";
$p = mysql_fetch_row($req_prix);
$prix = $p[0];
//echo $idcat;
while($mod = mysql_fetch_array($mods))
<td width='200'><table>
</table>
</tr>";
}
echo"</table>";
mysql_close();
?>
3.3) 9 pts
<?php
session_start();
include "connexion.php";
$idmod = $_GET['mod'];
$_SESSION['idmod'] = $idmod;
$cat = mysql_fetch_row($res);
echo "<table>
<tr><td colspan='2'></td></tr>
<td>{$cat[0]}</td></tr>";
<td>{$cat[1]}</td></tr>";
</select></td></tr>";
</select></td></tr>";
for($i=1; $i<=31;$i++)
echo "</select>
<select name='mois_dep'>";
for($i=1; $i<=12;$i++)
echo "</select>
<select name='annee_dep'>";
for($i=2013; $i<=2020;$i++)
echo "</td></tr>";
echo "</table>";
mysql_close();
?>
3.4) 8 pts
<?php
session_start();
$d=$_POST['jour_dep']."/".$_POST['mois_dep']."/".$_POST['annee_dep'];
$_SESSION['date_dep']=$d;
$_SESSION['agence_dep']=$_POST['agence_dep'];
$_SESSION['agence_ar']=$_POST['agence_ar'];
$_SESSION['nbjours']=$_POST['nbjours'];
echo "<center><table>
<tr><th colspan='2'>Authentification</th></tr>
<tr><td colspan='2'></td></tr>
?>
3.5) 9 pts
<?php
session_start();
include('connexion.php');
$email = $_POST['email'];
$pwd = $_POST['pwd'];
$res = @mysql_query("select nom from client where email='$email' and pwd='$pwd'") or die("Erreur
requête client");
if(mysql_num_rows($res) == 0)
else {
$n = mysql_fetch_row($res);
$nom = $n[0];
$idmod = $_SESSION['idmod'];
$catmod = mysql_fetch_row($res);
$cat = $catmod[0];
$prix = $catmod[1];
$mod = $catmod[2];
$total = $prix*$_SESSION['nbjours'];
echo "<table>
<tr><td colspan='2'></td></tr>
<tr><td>Modèle :</td><td>$mod</td></tr>
<tr><td colspan='2'></td></tr>
</table>";
mysql_close();
?>
3.6) 7 pts
<?php
include('connexion.php');
$f = fopen("categories.xml", "w");
fputs($f,"<categories>\r\n");
while($ln = mysql_fetch_array($res))
fputs($f,"<categorie>\r\n");
fputs($f,"\t<idcat>{$ln['idcat']}</idcat>\r\n");
fputs($f,"\t<libelle>{$ln['libelle']}</libelle>\r\n");
fputs($f,"\t<prix>{$ln['prix']}</prix>\r\n");
fputs($f,"</categorie>\r\n");
fputs($f,"</categories>");
fclose($f);
?>