UNIVERSITY OF WEST ATTICA
SCHOOL OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING AND INFORMATICS
University of West Attica · Department of Computer Engineering and Informatics
Software Development Methodologies
Vasileios Evangelos Athanasiou
Student ID: 19390005
Supervision
Supervisor: Georgios Prezerakos, Professor
Co-supervisor: Angelos Georgoulas, Assistant Professor
Athens, March 2023
This project implements Exercise 1: Classes and Objects, based on the specifications from the Department of Computer Engineering and Information Technology at the University of West Attica.
The goal is to design a Java class hierarchy that models different types of vehicles while practicing key Object-Oriented Programming (OOP) concepts.
| Section | Folder/File | Description |
|---|---|---|
| 1 | INSTALL.md |
Installation and execution instructions |
| 2 | README.md |
Project overview and usage information |
| 3 | assign/ |
Assignment description documents |
| 3.1 | assign/SDM Exercise 1 (Classes & Inheritance).pdf |
Assignment description (English) |
| 3.2 | assign/ΜΑΕ Ασκήση 1 (Classes & Inheritance).pdf |
Assignment description (Greek) |
| 4 | src/ |
Java source code implementing classes and inheritance |
| 4.1 | src/Vehicle.java |
Base Vehicle class definition |
| 4.2 | src/Car.java |
Car class inheriting from Vehicle |
| 4.3 | src/Plane.java |
Plane class inheriting from Vehicle |
| 4.4 | src/VehicleTest.java |
Test program demonstrating the functionality of the classes |
The exercise demonstrates how to build a structured class hierarchy using:
- Inheritance
- Encapsulation
- Method overriding
- State management through class attributes
The system includes a base Vehicle class and two specialized classes:
- Car
- Plane
- Implement inheritance using a base
Vehicleclass and derived classes (Car,Plane) - Manage class attributes and constructors
- Apply method overriding, especially the
toString()method - Handle state transitions, such as maintenance tracking based on usage
The Vehicle class contains attributes common to all vehicles.
makemodelyearweightneedsMaintenance(boolean, default = false)tripsSinceMaintenance(int, default = 0)
repair()
public void repair() {
tripsSinceMaintenance = 0;
needsMaintenance = false;
}Resets the maintenance state of the vehicle.
The Car class extends Vehicle.
isDriving(boolean)horsepower(int)
drive()- Sets
isDriving = true
- Sets
stop()- Sets
isDriving = false - Increments
tripsSinceMaintenance
- Sets
Maintenance rule:
If tripsSinceMaintenance > 100
→ needsMaintenance = trueThe Plane class also extends Vehicle.
isFlying(boolean)wingspan(float)
fly()- Allowed only when
needsMaintenance == false - Otherwise prints a warning message and prevents takeoff
- Allowed only when
land()- Sets
isFlying = false - Increments tripsSinceMaintenance
- Sets
Maintenance rule:
If tripsSinceMaintenance > 80
→ needsMaintenance = true