Travaux pratiques (TP) - Programmation
83 documents à télécharger gratuitement
Travaux pratiques (TP) de programmation, partagés par des étudiants et des enseignants. Thèmes couverts : algorithmique, langage C, Java, Python, POO, structures de données.
This document focuses on abstract classes and interfaces in the context of product management. It implements classes for both discounted and non-discounted products, showcasing polymorphism and inheritance. A main program calculates and identifies the product with the highest total value. Interfaces are then utilized to redefine the product functionality, enhancing flexibility and separation of concerns.
This document provides a step-by-step guide for compiling a static library in C. It includes the creation of a factorial function implementation and a program to utilize this function. The document also outlines the compilation commands necessary to produce an executable from the static library.
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.
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...
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...
The document provides a programming exercise in Java for students studying Object-Oriented Programming. The primary tasks include implementing and testing a class to process arrays and compute various operations such as sums, averages, and search functions. Additional exercises cover writing a method to identify palindromes and implementing a string manipulation class with functionalities like counting words, categorizing vowels and consonants, and extracting numeric characters. The solutions include method definitions and a main method for testing purposes.
This document outlines a practical exercise for students in the context of Object-Oriented Programming. It includes three main tasks: defining a class capable of creating and managing integer arrays, implementing a sorting mechanism for these arrays, and applying this functionality through a predefined program stub. The methodology emphasizes coding and object-oriented principles, such as encapsulation and modularity. Results are generated by creating, sorting, and displaying integer arrays using Java code.
This document is a Java programming lab assignment designed for SI2-B gTP2 students at Université de Carthage, specifically for Object-Oriented Programming. It includes a series of exercises focusing on Java classes, methods, and basic object-oriented paradigms. Exercises involve analyzing a given program, implementing classes with constructors and methods, such as for 'Temps' and 'Point', and performing operations like translations, distance calculations, and evaluating program outputs. The final exercise involves creating a program to calculate the area and perimeter of a square using use...
This document delves into the implementation of Java classes to model bank accounts, focusing on key object-oriented programming principles such as encapsulation, accessors, and mutators. It mandates creating a `Compte` class with attributes, constructors, methods for crediting, debiting, and transferring funds, alongside rules for overdraft and maximum debit limits. The tasks include implementing private attributes, defining methods for account management, and creating a `TestCompte` class to validate functionality. The primary focus is on reinforcing conceptual understanding of OOP while...
This document provides a series of Java practical exercises designed to familiarize students with key programming concepts such as object-oriented programming, inheritance, and interfaces. It includes exercises to create and manipulate classes like 'Date', 'Point', 'TableauTrie', and 'Coordonnees', encouraging encapsulation and method implementation. The methodology incorporates practical testing within Java environments, focusing on hands-on coding tasks. Various core aspects of Java including exception handling, polymorphism, and abstract classes are covered in these exercises.
This document serves as lecture notes for object-oriented programming, focusing on the concepts of variables, methods, and object manipulation through practical exercises. It introduces foundational concepts such as instance variables, class variables, and local variables alongside constructors and methods for object creation, data access, and management. Practical tasks guide readers through the creation of classes and methods to represent and manipulate points on a Cartesian plane and implement address books in programming. Exercises require basic functionality expansions, including const...
This document presents a lab report on Java RMI programming, including the implementation of remote methods for mathematical calculations. It covers the creation of server and client classes, compilation steps, and execution instructions. Additionally, it outlines exercises focusing on various Java RMI concepts and practices.
This document provides a detailed account of a JAVA/RMI lab exercise conducted by students. It covers the implementation and testing of various Java classes related to remote method invocation. Additionally, it includes steps for server and client setup as well as object factory implementation.
This document reports on a lab exercise focused on Java RMI. It includes multiple exercises requiring the implementation and testing of RMI components such as client and server applications. The final sections cover code examples and testing instructions.
This document outlines the process of developing a Windows Forms application in Visual Studio 2010 using C#. It introduces key concepts like projects and solutions, as well as the interface elements within the Visual Studio environment. The tutorial provides a step-by-step guide to building a simple calculator application, covering user interface design, properties configuration, and event-driven coding for arithmetic button functionality. Additional features like interfacing with multiple forms and debugging techniques are also highlighted.
This practical exercise involves designing an interface for a billing system, processing product data to compute line item totals, and determining the total amount, discount, and net payable. Key components use TextBox controls for data input, Buttons to trigger calculations, and a Timer control to display the current date and time dynamically. The task requires implementing conditional logic for the discount calculation and handling KeyPress events to automate focus changes between controls during user interaction.
This document is a practical lab assignment for creating a small website by utilizing different web techniques. It is divided into three parts, starting with the use of framesets, followed by <div> tags and stylesheets, and finally leveraging features from HTML5 and CSS3. The assignment includes creating a multi-page website with specific layout requirements, such as individual pages for header (entete.html), menu (menu.html), content (contenu.html), and footer (footer.html), which are combined in a main index.html page using framesets for layout definition. Detailed visual and structural r...
This document outlines a lab exercise focused on inter-process communication and synchronization using monitors. It includes various exercises that implement solutions to problems such as readers-writers and philosophers. The aim is to demonstrate the application of monitors and IPC in managing resource access among multiple processes.
This document outlines a lab exercise focused on multi-threading in the context of managing students in a classroom setting. It discusses the implementation of an algorithm for synchronizing multiple student threads with a teacher thread. The task is to complete a provided function related to student thread behavior.
This document provides an overview of various string manipulation methods available in JavaScript, including indexOf, lastIndexOf, charAt, and several others. Each method is illustrated with examples to demonstrate its functionality. Understanding these methods is crucial for effective string handling in programming.
This document explores key concepts and implementations of linked lists in C. It includes several exercises with corresponding code snippets to create, display, modify, and calculate properties of linked lists. Topics such as stack management using linked lists, insertion, deletion, reversed list generation, and list manipulations such as square values are discussed. The exercises aim to strengthen understanding of dynamic memory allocation, pointers, and data structure operations in C.
The document outlines a programming exercise for managing a library system using object-oriented programming principles, including inheritance and polymorphism. Key classes such as 'Ouvrage', 'Livre', 'Video', and 'Bibliotheque' are identified and described with corresponding attributes and methods. The functionality includes adding unique works to the library, retrieving specific works, and displaying library contents. A test class demonstrates the implementation and behavior of the system, including scenarios for book availability and polymorphic behavior through the 'affiche' method.
This document outlines two exercises focusing on object-oriented programming concepts in Java. Exercise 1 involves creating a 'TableauTrie' class to manage a sorted array of integers with methods for insertion, deletion, search, and display, along with an accompanying test class 'TestTableauTrie'. Exercise 2 requires the implementation of a 'Decouper' class for tokenizing text based on specified delimiters, with a test class 'TestDecouper' provided. Core functionalities like handling data structures, employing loops, and method writing are emphasized. The exercises demonstrate OOP principle...
This document outlines a practical assignment focused on creating and manipulating student entities using object-oriented programming. It involves defining a `Student` class with private attributes such as name, age, and average score, along with methods like comparing averages and displaying student data. The assignment also requires creating a `TestStudent` class to instantiate objects, compare their attributes, and demonstrate updates to their values. Students are prompted to refactor the code by removing specific methods and handling comparisons directly in the `main` method.















