Programmation

782 documents à télécharger gratuitement

Cours, examens, TD, TP et exercices de programmation. Thèmes couverts : algorithmique, langage C, Java, Python, POO, structures de données.

TP4 C# - Déplacement des éléments d’une liste vers une autre liste

This document explains the development of a C# application to handle element transfer between two lists using various user interfaces facilitated by a TabControl component with four TabPages. It offers functionality for single and multiple selections in ListBox and CheckListBox controls, alongside features embracing 'drag-and-drop' capabilities. Buttons are provided to add, remove, clear, and transfer elements between the lists. Key C# properties and methods related to ListBox operations, as well as Drag-and-Drop event handling, are described in the annex for reference.

C#
ListBox
Drag-and-Drop
5p0
Généricité et collections en JAVA

This document explores Java's generic programming capabilities and their application in collections. It introduces key concepts like generic types and interfaces, showcasing their importance through hands-on exercises such as implementing stacks (using both arrays and linked lists), creating complex tasks with hierarchical structures, and managing contact directories via HashMaps. The methodology focuses on transforming existing code into generic implementations, using Java's core collection frameworks to emphasize the extensibility and type safety of generics. The findings highlight practi...

generics
collections
Java
9p0
Correction du TP n°7 - Exceptions et Classes Abstraites

This document explores exception handling and abstract classes in Java through exercises and detailed code examples. It demonstrates practical implementation of exception propagation, custom exceptions, constructors with exceptions, and the `finally` clause. Abstract classes are utilized to design a sorted object structure, comparing their usage with interfaces. Key findings include the role of `finally` in exception control flow and the power of abstraction for structured problem-solving.

Exception Handling
parseInt
SecretMissionException
7p0
TD 1: Révision

This document serves as an exercise-based revision guide to strengthen programming concepts. It discusses exception handling using Java, addressing methods like parseInt and custom exception creation. The exercises focus on implementing and testing custom exceptions in classes like 'Entreprise' and its derivatives, as well as practical usage of the 'Toutou' class constructor with validations. Additionally, it introduces abstract classes with 'TabTrie', discussing inheritance, sorting, and the use of exceptions within data structures.

exception handling
parseInt
SecretMissionException
Institut Supérieur des Études Technologiques2p0
Advanced Object-Oriented Programming Workshop

The document outlines instructions for creating and manipulating various Java collections such as ArrayList, Vector, LinkedList, and HashMap. It provides a step-by-step methodology for initializing, populating, displaying, sorting, and traversing these collections. Specific methods such as addFirst, addLast, and deletion processes are covered. The document emphasizes practical implementation through a Java project structure and test class development.

collections
ArrayList
Vector
Institut Supérieur des Études Technologiques1p0
Genericity & Collections in Java

The document introduces the concept of genericity in Java and demonstrates its application using collections such as LinkedList and ArrayList. It provides step-by-step exercises to implement generic stacks, using interfaces and extending key Java classes like Collection and LinkedList, for better type-safety and reusability. The exercises also cover implementing generic tasks and building a phonebook using HashMaps, emphasizing the importance of data structures with type parameters. Each task highlights practical code examples and challenges to learn about Java's generics and collections API.

Genericity
Java Collections API
Stack Implementation
9p0
Généricité (Polymorphisme paramétrique) en Java

This document explores the concept of generics (parametric polymorphism) in Java. It starts with motivating scenarios for handling different data types in collections, emphasizing issues like code duplication and runtime errors. It contrasts early Java approaches (pre-1.5) with modern generic programming introduced in Java 1.5, demonstrating increased safety and reusability. The document delves into technical features such as type erasure, parametrized classes, and limitations like shared static members and runtime type constraints. Finally, it emphasizes the robustness and simplicity gener...

generics
type erasure
Java 1.5
29p0
Understanding Java Collections: Overview and Implementation

This document provides a detailed explanation of Java's collection framework, covering interfaces such as Set, Map, and List, alongside their implementation classes like ArrayList, LinkedList, and TreeSet. It illustrates concepts like generics, iteration, and operations such as add, remove, and contains, emphasizing the use of methods for object handling. Examples with code snippets demonstrate the practical application of collections using Java syntax, detailing specific properties, advantages, and use cases for different collection types. Furthermore, implementation strategies and efficie...

Collections
TreeSet
Generics
38p0
Atelier Programmation Objet Avancée

The document serves as a step-by-step practical guide for working with Java collections, including ArrayLists, Vectors, LinkedLists, and HashMaps. Each section provides instructions for creating and manipulating data structures, such as adding elements, iterating, sorting, and using specialized methods like addFirst and addLast for linked lists. Additionally, the HashMap section introduces key-value pair manipulation and search techniques, emphasizing systematic output for observation. Overall, the methodology highlights iterative and customizable development practices for advanced object-o...

Java collections
ArrayList
LinkedList
Institut Supérieur des Études Technologiques1p0
Premiers principes de la programmation objet

This document introduces the fundamental principles of object-oriented programming, focusing on concepts such as objects, classes, inheritance, encapsulation, and polymorphism. It highlights the benefits of modularity, reusability, and abstraction in software design. Various examples, including UML notation, abstract classes, and interfaces, are used to elucidate key programming techniques. The material emphasizes best practices like distinguishing inheritance from association and adhering to design patterns for scalable architecture.

object-oriented programming
inheritance
polymorphism
34p0
Programmation événementielle et architecture modèle-vue-contrôleur

This document explores event-driven programming as a distinct paradigm, emphasizing its non-linear execution model. It defines core principles, such as reacting to generated events and processing them via listeners and queues. The implementation of events often relies on observer patterns or notification models. Furthermore, the Model-View-Controller (MVC) architecture is explained for managing applications with user interfaces, enabling modular development and decoupling of components. The benefits include simplified development workflows, modular task assignments, and enhanced adaptabilit...

event-driven programming
observer pattern
MVC architecture
23p0
Programmation événementielle (C# sous le framework .Net)

This document provides a comprehensive overview of event-driven programming principles using C# and the .Net framework. It explores core concepts such as graphical objects, events, and their interactions with user-driven applications. The material illustrates the theoretical aspects of the .Net platform, including its architecture and components, as well as practical implementation with Microsoft Visual Studio. Through progressive sections, the content details the functioning of the .Net architecture and highlights programming practices like compilation, intermediate code, and execution mod...

Event-driven programming
C#
.Net framework
Institut Supérieur des Études Technologiques de Bizerte108p0
Exceptions and Abstract Classes - Java Exercises

This document provides a detailed exploration of Java programming concepts using practical exercises, focusing on exceptions handling and abstract classes. Methodology includes coding tasks like using parseInt for arithmetic operations on command-line arguments, creating custom exceptions for class hierarchies, and employing constructors to validate input through exception propagation. Additionally, the functionality of interfaces versus abstract classes is analyzed, highlighting the benefits of abstract classes in organizing sorted collections such as arrays of objects. The findings unders...

NumberFormatException
TabTrie abstract class
SecretMissionException
7p0
TD 1 : Révision

This document presents exercises focusing on Java programming concepts such as exception handling, class inheritance, and abstraction. The first exercise demonstrates the use of the parseInt method to sum integers from command-line arguments, ignoring non-integer entries. The second exercise involves designing a class hierarchy to handle custom exceptions related to company attributes such as mission and capital. The third exercise focuses on constructors propagating exceptions when incorrect arguments are provided to instances of a 'Dog' class. Lastly, the fourth exercise addresses abstrac...

Exception Handling
parseInt
IllegalArgumentException
2p0
Le traitement des Exceptions

This document provides a structured tutorial for exception handling in Java, guiding through the creation of a package named 'Exception.' The methodology involves creating classes such as 'Calcul' and 'CheckingAccount,' implementing exception-handling mechanisms like try-catch blocks and custom exceptions (e.g., InsufficientFundsException). Specific behaviors for deposit and withdrawal functionality, with corresponding validations, are demonstrated in the 'CheckingAccount' class. Furthermore, the document incorporates testing methodologies using the 'BankDemo' class and introduces refinemen...

Exception handling
InsufficientFundsException
JAVA programming
Institut Supérieur des Études Technologiques2p0
Le traitement des Exceptions

This document provides a detailed methodology for handling exceptions in Java, including creating custom exceptions and testing exception flows. It focuses on implementing a package named 'Exception' containing classes such as 'Calcul' and 'CheckingAccount,' and demonstrates exception handling principles like try-catch blocks, delegation of exceptions using throws, and creation of custom exception classes like 'InsufficientFundsException.' It also walks through a practical example with bank account operations and encourages refinement via database integration using MySQL.

exception handling
throws
throw
Institut Supérieur des Études Technologiques2p0
Résumé de syntaxe du langage C#

This document provides an overview of the C# programming language syntax with detailed explanations of fundamental constructs. It covers topics such as data types and type conversion, strings, arrays (including multidimensional and jagged arrays), and cloning. Advanced concepts like inheritance, constructors, polymorphism, interface implementation, operator overloading, indexers, and generic classes/functions are also addressed. The document aims to provide a comprehensive guide to C# programming for academic use, with contributions by L. Buzer and B. Perret of ESIEE in 2011.

C# programming
inheritance
polymorphism
1p0
Chapitre 0: Exception et Généricité

This document introduces the concept of exceptions in Java, outlining how exceptions are used for efficient error management by separating normal and abnormal execution. It details the predefined exceptions and error-handling mechanisms like 'try', 'catch', and 'finally', and explains user-defined exceptions using the 'throw' keyword. Additionally, the document covers the concept of generics, illustrating how generics enable type-safe data structures and prevent runtime type casting errors by allowing classes and interfaces to be parameterized with specific data types.

exception handling
Throwable
generics
1p0
Les Packages

This document explains the concept and usage of packages in Java programming. It highlights the structure and benefits of packages, such as improved organization and class transportability. The document also details the naming conventions for packages and demonstrates the accessibility levels of classes (public vs default) within or across packages. Finally, examples are provided to illustrate the scope of classes and methods to ensure clarity in package utilization.

packages
Java
access modifiers
6p0
Les Tableaux

This document introduces arrays in Java programming, explaining their essential role in storing sequential data elements of the same type. It describes the syntax for declaring and initializing one-dimensional and multidimensional arrays, detailing their functionality through examples. It further explores operations such as iterating through arrays using loops, searching elements, and handling exceptions like index out-of-bounds errors. Finally, it demonstrates advanced loop techniques for traversing arrays efficiently using newer JDK syntax.

arrays
array syntax
Java programming
9p0
POO – Classes Abstraites et Interfaces

This document introduces abstract classes and interfaces as fundamental concepts in object-oriented programming. The methodology involves defining abstract classes that cannot be instantiated but serve as base classes for derived classes, which implement abstract methods. Interfaces are presented as constructs defining only method signatures and constants, enabling multiple inheritance and inter-class interaction. Practical examples illustrate syntax, implementation, and the functional importance of both constructs in software development.

abstract class
interface
inheritance
33p0
Lire les entrées clavier

This chapter introduces handling user input in Java using the Scanner class from the java.util package. The tutorial explains how to instantiate a Scanner object, read various data types such as strings, integers, and doubles, and handle console input efficiently. It also highlights common pitfalls like input stream issues and provides solutions to manage them. A hands-on coding example demonstrates how to write a program for user input and safely process it.

Scanner class
System.in
nextLine()
6p0
POO – Classes Abstraites et Interfaces

This document introduces the concepts of abstract classes and interfaces as core components of object-oriented programming. The methodology includes an explanation of syntax, rules, and practical applications of abstract classes and interfaces. Abstract classes are designed to serve as base classes, providing structure for derivative implementations. Interfaces allow multiple inheritance-like behavior by enabling the implementation of common method signatures without imposing specific inheritance structures. Examples illustrate abstract methods, interfaces with constants, and conflict resol...

abstract class
interface
inheritance
8p0
L’héritage en Java

This document introduces the concept of inheritance in Java, explaining its purpose, functionality, and implementation. It outlines the advantages of inheritance for code reuse and efficiency, including polymorphism and method overriding. The lecture details how constructors and methods behave in parent and child classes and distinguishes between method redefinition and overloading. Practical examples demonstrate inheritance through classes such as 'Vehicule', 'Voiture', and 'Rectangle'. Common pitfalls and best practices, such as encapsulation and visibility management, are also discussed.

inheritance
polymorphism
method overriding
70p0

Autres ressources en programmation