Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 1 out of 4 pages
Exam (elaborations)

Object-Oriented Programming in Python

Document preview thumbnail
Preview 1 out of 4 pages

Object-Oriented Programming (OOP) is a powerful programming paradigm that allows you to organize your code into objects that have properties and methods. This course is designed for intermediate-level Python programmers who want to learn how to use OOP concepts in Python. Throughout this course, you will learn the core principles of OOP, such as encapsulation, inheritance, and polymorphism, and how to apply them in Python. You will also learn how to create classes and objects, define attributes and methods, and use inheritance to create new classes based on existing ones. By the end of this course, you will have a solid understanding of OOP concepts in Python and be able to design and implement object-oriented programs to solve complex problems. You will also be ready to explore more advanced topics in OOP and Python, such as design patterns and GUI programming. Course Outline: Introduction to OOP What is OOP? Advantages of OOP Core principles of OOP OOP in Python Classes and Objects Defining classes and objects Instance variables and methods Constructors and destructors Class variables and methods Encapsulation and Abstraction Encapsulation in Python Access modifiers Abstraction in Python Inheritance Inheritance in Python Single and multiple inheritance Method resolution order (MRO) Abstract classes and interfaces Polymorphism Polymorphism in Python Method overriding and overloading Duck typing Exception Handling in OOP Exceptions in Python Raising and catching exceptions Custom exceptions Advanced OOP Concepts Design patterns in Python Decorators and descriptors Metaclasses Garbage collection Prerequisites: To take this course, you should have a solid understanding of basic Python programming concepts such as variables, data types, conditional statements, loops, functions, and modules. You should also be familiar with object-oriented programming concepts such as classes, objects, inheritance, and polymorphism. If you are new to OOP, we recommend taking an introductory Python course or reading an OOP textbook before taking this course.

Content preview

POO TDD 101.102.103




POO_TP N° 1
Objet, Classe, Surcharge, Constructeur, Destructeur
Objectifs :
Définir les propriétés et méthodes d’une classe
Créer une instance de classe
Accéder par les accesseurs aux propriétés en lecture et écriture d’un objet Appliquer
des méthodes
Définir des constructeurs
Apprendre à surcharger une méthode.


Travail demandé :
Exercice 1 :
1) Créer une classe Python nommée CompteBancaire qui représente un compte bancaire, ayant pour
attributs : numeroCompte (type numérique ) , nom (nom du propriétaire du compte du type chaine),
solde.
2) Créer un constructeur ayant comme paramètres : numeroCompte, nom, solde.
3) Créer une méthode Versement() qui gère les versements.
4) Créer une méthode Retrait() qui gère les retraits.
5) Créer une méthode Agios() permettant d'appliquer les agios à un pourcentage de 5 % du solde
Créer une méthode afficher() permettant d’afficher les détails sur le compte
6) Donner le code complet de la classe CompteBancaire.
7)

Exercice 2 :
1) Définir une classe Employé caractérisée par les attributs
:Matricule, Nom, Prénom, DateNaissance, DateEmbauche, Salaire.
2) Définir un constructeur permettant d’initialiser les attributs de la méthode par des
valeurs saisies par l’utilisateur.
3) Ajouter à la classe la méthode Age( ) qui retourne l’âge de l’employé.
4) Ajouter à la classe la méthode Anciennete( ) qui retourne le nombre d’années
d’ancienneté de l’employé.
5) Ajouter à la classe la méthode AugmentationDuSalaire( ) qui augmente le salaire de
l’employé en prenant en considération l’ancienneté.
- Si Ancienneté < 5 ans, alors on ajoute 2%.
- Si Ancienneté < 10 ans, alors on ajoute 5%.
- Sinon, on ajoute 10%.
6) Ajouter la méthode AfficherEmployé() qui affiche les informations de l’employé comme
suit :
- Matricule : […]
- Nom complet : [NOM Prénom]
- Age : […]
- Ancienneté : […]
- Salaire : […]
7) Ecrire un programme de test pour la classe Employé.




1/4 2022 /2023

Document information

Study
Unknown
Uploaded on
May 3, 2023
Number of pages
4
Written in
2022/2023
Type
Exam (elaborations)
Contains
Only questions
$7.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
2
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions