SlideShare une entreprise Scribd logo
1  sur  2
Télécharger pour lire hors ligne
TD/TP1
Pensez Objets avec JAVA
Objectifs du TD/TP
  Préparer à Java Interview

  Comment penser objet ?

  Maitriser les concepts Orienté Objet par la pratique « Learn by Doing » (Projets en groupe)
Notes de l’étudiant :
 TD/TP1 Pensez Objets avec JAVA Dr A. BENGUEDDACH
 Page 1
TD/TP1
Pensez Objets avec JAVA
Projet 1 : Simulation du jeu de
1. Créez une classe De qui a comme méthode
lancer-de() renvoyant un nombre entier entre 1
et 6.
Indication : Utilisez la classe Math.random() de la
classe java.lang.
2. Soient n joueurs. A chaque tour un joueur lance
le et marque un score qui correspond au
nombre de points marqués par le . Créez une
classe Joueur qui a une méthode score () qui
renvoie le score pour un joueur donné.
3. En utilisant les classes Joueur et De déjà
construites, écrire un programme qui simule 10
tours et affiche le nom du gagnant.
Projet 2 : Application de messagerie
Vous êtes chargé de créer des comptes de
messagerie pour les nouvelles recrues de votre
entreprise-employeur. Votre application devrait:
1. Générer une adresse électronique {class : Email}
à partir du nom et prénom de l’employé.
2. Générer un mot de passe aléatoirement pour le
compte crée.
4. Définir une autre adresse courriel alternative
{Gmail, Yahoo, Hotmail, …}
5. Avoir des méthodes pour modifier le mot de
passe, l’adresse alternative.
6. Afficher l’adresse mail avec la syntaxe suivante :
firstname.lastname@company.com
Projet 3 : Carnet de Contacts (Devoir)
1. Créer une classe Personne identifiée par son
nom, téléphone, email (utiliser ma classe Email de
l’exercice précédent), groupe.
2. Définir une méthode qui permet d’afficher les
informations d’une personne.
3. Créez une classe Contact (une liste de
personnes) avec comme méthodes : ajoutContact(),
suppContact(), modifierContact(), mesAmis(),
maFamille(), colleguesTravail(), mesFavoris(),
afficheContact(), chercherContact().
ps : La méthode afficheContact() doit afficher
toute la liste des contacts par ordre alphabétique.
4. Ecrire un programme qui permet chercher un
nom de contact dont le nom commence par un "L"
et qui appartient à la catégorie "amis".
Projet 4 : Compte Bancaire
1. Créez une classe Compte constitué des
champs : numéro de compte, solde associé à un
client donné.
2. Un client peut avoir deux comptes bancaires.
3. Ecrire un programme qui simule l’ouverture de
deux comptes bancaires pour un client donné,
affiche les informations sur les deux comptes ainsi
que les transactions faites par ce client.
« La seule façon de faire du bon travail est
d’aimer ce que vous faites. Si vous n’avez pas
encore trouvé, continuez à chercher. »
Steve Jobs

Contenu connexe

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

En vedette (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Tp1 pensez-objets-18

  • 1. TD/TP1 Pensez Objets avec JAVA Objectifs du TD/TP   Préparer à Java Interview    Comment penser objet ?    Maitriser les concepts Orienté Objet par la pratique « Learn by Doing » (Projets en groupe) Notes de l’étudiant :
  • 2.  TD/TP1 Pensez Objets avec JAVA Dr A. BENGUEDDACH  Page 1 TD/TP1 Pensez Objets avec JAVA Projet 1 : Simulation du jeu de 1. Créez une classe De qui a comme méthode lancer-de() renvoyant un nombre entier entre 1 et 6. Indication : Utilisez la classe Math.random() de la classe java.lang. 2. Soient n joueurs. A chaque tour un joueur lance le et marque un score qui correspond au nombre de points marqués par le . Créez une classe Joueur qui a une méthode score () qui renvoie le score pour un joueur donné. 3. En utilisant les classes Joueur et De déjà construites, écrire un programme qui simule 10 tours et affiche le nom du gagnant. Projet 2 : Application de messagerie Vous êtes chargé de créer des comptes de messagerie pour les nouvelles recrues de votre entreprise-employeur. Votre application devrait: 1. Générer une adresse électronique {class : Email} à partir du nom et prénom de l’employé. 2. Générer un mot de passe aléatoirement pour le compte crée. 4. Définir une autre adresse courriel alternative {Gmail, Yahoo, Hotmail, …} 5. Avoir des méthodes pour modifier le mot de passe, l’adresse alternative. 6. Afficher l’adresse mail avec la syntaxe suivante : firstname.lastname@company.com Projet 3 : Carnet de Contacts (Devoir) 1. Créer une classe Personne identifiée par son nom, téléphone, email (utiliser ma classe Email de l’exercice précédent), groupe. 2. Définir une méthode qui permet d’afficher les informations d’une personne. 3. Créez une classe Contact (une liste de personnes) avec comme méthodes : ajoutContact(), suppContact(), modifierContact(), mesAmis(), maFamille(), colleguesTravail(), mesFavoris(), afficheContact(), chercherContact(). ps : La méthode afficheContact() doit afficher toute la liste des contacts par ordre alphabétique. 4. Ecrire un programme qui permet chercher un nom de contact dont le nom commence par un "L" et qui appartient à la catégorie "amis". Projet 4 : Compte Bancaire 1. Créez une classe Compte constitué des champs : numéro de compte, solde associé à un client donné. 2. Un client peut avoir deux comptes bancaires. 3. Ecrire un programme qui simule l’ouverture de deux comptes bancaires pour un client donné, affiche les informations sur les deux comptes ainsi que les transactions faites par ce client. « La seule façon de faire du bon travail est d’aimer ce que vous faites. Si vous n’avez pas encore trouvé, continuez à chercher. » Steve Jobs