NTIC Faculty L1/S2 2023–2024
Introduction to Object-Oriented Programming
Lab 1
Exercise 1: A first Java program with Eclipse
Using the Eclipse IDE, write a Java program that displays on the screen: your
name, first name, group, and age. To do this, create a Java project "OOP_Lab"
and a class "Ex1".
Exercise 2: Classes in Java
Without giving their details (attributes and methods), define the following
classes in Java: Person, Student, Teacher, Module, Lecture.
Exercise 3: Attributes and methods
Develop the classes 'Person' and 'Module' defined in exercise 2 by:
- attributes: name, first name, and nin (national identification number) for the
'Person' class, and mod_code and teacher_code for the 'Module' class.
- methods to display information about objects of these classes.
Exercise 4: Objects and messages
Write the main method to:
1. create two objects p and f of the 'Person' class.
2. display the values of their attributes.
3. modify the attribute values of object p with values of your choice, display
the new values.
4. create an object t of type 'Teacher'.
5. invoke a method createModule of an object t of the 'Teacher' class to create
an object m of the 'Module' class.
6. display the value of the attribute mod_code of object m.
7. modify this value and display the new value.