MàJ par récupération sur Clé USB et dans /mnt/hd/Chargement du pc portable
This commit is contained in:
		
							
								
								
									
										118
									
								
								G5a/Exercices/3-exosClasses1.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								G5a/Exercices/3-exosClasses1.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,118 @@
 | 
			
		||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 | 
			
		||||
<HTML>
 | 
			
		||||
<HEAD>
 | 
			
		||||
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
 | 
			
		||||
	<TITLE>exosJavaClasse 1</TITLE>
 | 
			
		||||
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.2  (Win32)">
 | 
			
		||||
	<META NAME="CREATED" CONTENT="20070910;17190910">
 | 
			
		||||
	<META NAME="CHANGED" CONTENT="16010101;0">
 | 
			
		||||
	<STYLE TYPE="text/css">
 | 
			
		||||
	<!--
 | 
			
		||||
		@page { size: 21cm 29.7cm }
 | 
			
		||||
		H2.western { font-family: "Albany", sans-serif; font-size: 14pt; font-style: italic }
 | 
			
		||||
		H2.cjk { font-family: "HG Mincho Light J"; font-size: 14pt; font-style: italic }
 | 
			
		||||
		H2.ctl { font-family: "Arial Unicode MS"; font-size: 14pt; font-style: italic }
 | 
			
		||||
	-->
 | 
			
		||||
	</STYLE>
 | 
			
		||||
</HEAD>
 | 
			
		||||
<BODY LANG="fr-FR" DIR="LTR">
 | 
			
		||||
<H1><FONT FACE="Arial">Exercices java : Classes et héritage</FONT></H1>
 | 
			
		||||
<H2 CLASS="western"><FONT FACE="Arial">1. Adherent</FONT></H2>
 | 
			
		||||
<UL>
 | 
			
		||||
	<P><FONT FACE="Arial"><B>1.1.</B> Traduire en java la classe
 | 
			
		||||
	"Adherent" vue en cours </FONT>
 | 
			
		||||
	</P>
 | 
			
		||||
</UL>
 | 
			
		||||
<P>          
 | 
			
		||||
<IMG SRC="DCA-Adherent.jpg" NAME="Image1" ALT="DCA-adherent" ALIGN=BOTTOM WIDTH=221 HEIGHT=235 BORDER=0>
 | 
			
		||||
</P>
 | 
			
		||||
<UL>
 | 
			
		||||
	<P><FONT FACE="Arial"><BR><B>1.2. </B>Creer le constructeur et un
 | 
			
		||||
	main  qui utilise cette classe  (création  d'
 | 
			
		||||
	adherents , cotisation...,)  ; ajouter une methode "etat()"
 | 
			
		||||
	qui renvoie "a jour" ou "pas a jour" et une
 | 
			
		||||
	methode toString()<BR><B>1.3. </B>Créer un package "PackAdh"
 | 
			
		||||
	; y placer la classe Adherent et une  classe "Gerant"
 | 
			
		||||
	qui fait la saisie de 3 adherents et teste à chaque fois
 | 
			
		||||
	l'etat de ses adherents : (1, Dupont ,Paris 1980) ; (2, Meyer,
 | 
			
		||||
	Strasbourg, 1955) ; (3,Legwenn,Brest,1960) </FONT>
 | 
			
		||||
	</P>
 | 
			
		||||
</UL>
 | 
			
		||||
<UL>
 | 
			
		||||
	<LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><FONT FACE="Arial">Dupont
 | 
			
		||||
	verse 45 -> à jour</FONT></BLOCKQUOTE>
 | 
			
		||||
	<LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><FONT FACE="Arial">Meyer 
 | 
			
		||||
	verse 30 -> non à jour </FONT>
 | 
			
		||||
	</BLOCKQUOTE>
 | 
			
		||||
	<LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><FONT FACE="Arial">Legwenn 
 | 
			
		||||
	verse 40 -> non à jour </FONT>
 | 
			
		||||
	</BLOCKQUOTE>
 | 
			
		||||
	<LI><BLOCKQUOTE><FONT FACE="Arial">Meyer verse 15 <FONT FACE="Arial">->
 | 
			
		||||
	à jour</FONT> </FONT>
 | 
			
		||||
	</BLOCKQUOTE>
 | 
			
		||||
</UL>
 | 
			
		||||
<H2 CLASS="western"><FONT FACE="Arial">2. Personne/Femme </FONT>
 | 
			
		||||
</H2>
 | 
			
		||||
<UL>
 | 
			
		||||
	<P><STRONG><FONT FACE="Arial">2.1.</FONT></STRONG><FONT FACE="Arial"> 
 | 
			
		||||
	Créer  une classe "Personne" avec nom et année
 | 
			
		||||
	de naissance ; ajouter le constructeur et une méthode
 | 
			
		||||
	toString qui affiche les 2 propriétés ; ajouter un
 | 
			
		||||
	main qui crée quelques personnes. </FONT>
 | 
			
		||||
	</P>
 | 
			
		||||
	<P><FONT FACE="Arial"><B>2.2.</B> Créer une classe "Femme"
 | 
			
		||||
	qui hérite de Personne et qui possède en plus un nom
 | 
			
		||||
	de jeune fille ; ajouter le constructeur et une méthode
 | 
			
		||||
	toString qui affiche les 3 propriétés. Modifiez le
 | 
			
		||||
	main pour avoir le résultat suivant : </FONT>
 | 
			
		||||
	</P>
 | 
			
		||||
	<BLOCKQUOTE><FONT FACE="Courier New">Dupont 1970 <BR>Dupont 1972 née
 | 
			
		||||
	Durand</FONT></BLOCKQUOTE>
 | 
			
		||||
</UL>
 | 
			
		||||
<H2 CLASS="western"><FONT FACE="Arial">3. Confitures </FONT>
 | 
			
		||||
</H2>
 | 
			
		||||
<UL>
 | 
			
		||||
	<P><STRONG><FONT FACE="Arial">3.1.</FONT></STRONG><FONT FACE="Arial"> 
 | 
			
		||||
	Créer avec un AGL (StarUML, argoUML...) une classe "Confiture" comme
 | 
			
		||||
	celle-ci :</FONT></P>
 | 
			
		||||
</UL>
 | 
			
		||||
<P ALIGN=CENTER STYLE="margin-bottom: 0cm"><IMG SRC="Confiture.jpg" NAME="Image2" ALT="confiture" ALIGN=BOTTOM WIDTH=252 HEIGHT=117 BORDER=0></P>
 | 
			
		||||
<P ALIGN=LEFT>          
 | 
			
		||||
</P>
 | 
			
		||||
<UL>
 | 
			
		||||
	<P><STRONG><FONT FACE="Arial">3.2.</FONT></STRONG><FONT FACE="Arial">
 | 
			
		||||
	Compléter et générer : </FONT>
 | 
			
		||||
	</P>
 | 
			
		||||
	<UL>
 | 
			
		||||
		<LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Arial">Créer
 | 
			
		||||
		des accesseurs publics (get et set) pour les attributs sauf pour
 | 
			
		||||
		"id" qui doit etre incrémenté
 | 
			
		||||
		automatiquement (get seulement) Saisir le code du constructeur
 | 
			
		||||
		(ajouter ce qu'il faut pour l'autoincrémentation) </FONT>
 | 
			
		||||
		</P>
 | 
			
		||||
		<LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Arial">Générer
 | 
			
		||||
		le code du programme java correspondant. Ecrire une méthode
 | 
			
		||||
		</FONT><CODE><FONT FACE="Arial">main</FONT></CODE><FONT FACE="Arial">
 | 
			
		||||
		pour créer deux confitures et afficher l'id, le parfum et le
 | 
			
		||||
		nom du cuisinier. </FONT>
 | 
			
		||||
		</P>
 | 
			
		||||
		<LI><P><FONT FACE="Arial">Tester</FONT></P>
 | 
			
		||||
	</UL>
 | 
			
		||||
</UL>
 | 
			
		||||
<UL>
 | 
			
		||||
	<P><STRONG><FONT FACE="Arial">3.3.</FONT></STRONG><FONT FACE="Arial">
 | 
			
		||||
	Ajouter à la classe </FONT><CODE><FONT FACE="Arial">Confiture</FONT></CODE><FONT FACE="Arial">
 | 
			
		||||
	une méthode </FONT><CODE><FONT FACE="Arial">toString()</FONT></CODE><FONT FACE="Arial">
 | 
			
		||||
	qui renvoie une chaîne de caractères décrivant
 | 
			
		||||
	la confiture (id, parfum, cuisinier, année). </FONT>
 | 
			
		||||
	</P>
 | 
			
		||||
	<P><STRONG><FONT FACE="Arial">3.4.</FONT></STRONG><FONT FACE="Arial">
 | 
			
		||||
	Pour afficher la description des confitures, il est maintenant
 | 
			
		||||
	possible d'utiliser la méthode </FONT><CODE><FONT FACE="Arial">println()</FONT></CODE><FONT FACE="Arial">
 | 
			
		||||
	avec un argument de type </FONT><CODE><FONT FACE="Arial">Confiture</FONT></CODE><FONT FACE="Arial">.
 | 
			
		||||
	A tester dans la méthode </FONT><CODE><FONT FACE="Arial">main</FONT></CODE></P>
 | 
			
		||||
</UL>
 | 
			
		||||
<P STYLE="margin-left: 1.06cm"><BR><BR>
 | 
			
		||||
</P>
 | 
			
		||||
</BODY>
 | 
			
		||||
</HTML>
 | 
			
		||||
		Reference in New Issue
	
	Block a user