NTIC Faculty L1/S2 2023–2024
Introduction to Object-Oriented Programming
Lab 4
(Inheritance, Abstract Classes/Methods, ArrayList)
We want to create a property management system using inheritance and abstract classes/methods in Java.
We want to create two packages containing the following classes: Person, Owner, Tenant,
Accommodation, Villa, Apartment, Studio, Deed, Sale, and Rental.
1. Create an abstract class Person which contains the attributes (name, firstName, and address) and the
abstract methods buy() and rent().
2. Create two classes Owner and Tenant that inherit from the Person class. The Owner class contains an
additional attribute properties which will be a list of Accommodation objects. The Tenant class
contains an additional attribute rentals which will be a list of Accommodation objects.
3. Create an abstract class Accommodation which contains the attributes (address, area, and
numberRooms) and the abstract methods sell() and rent().
4. Create three classes Villa, Apartment, and Studio that inherit from the Accommodation class. The
Villa class contains an additional attribute garden, the Apartment class contains an additional
attribute floor, and the Studio class contains an additional attribute kitchenette.
5. Create an abstract class Deed which contains the attributes (accommodation, owner, client, and date)
and the abstract methods sign() and cancel().
6. Create two classes Sale and Rental that inherit from the Deed class. The Sale class contains an
additional attribute price. The Rental class contains additional attributes (startDate, endDate, rent).
7. Create a class containing the main method that constructs objects of each class and performs method
calls to test the property management system. Use arrays of objects and then ArrayList structures to
manipulate objects of the same class.