Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

University of West Attica

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

Classes and Inheritance

Vasileios Evangelos Athanasiou
Student ID: 19390005

GitHub · LinkedIn


Supervision

Supervisor: Georgios Prezerakos, Professor

UNIWA Profile · LinkedIn

Co-supervisor: Angelos Georgoulas, Assistant Professor

Scholar · LinkedIn


Athens, March 2023



README

Classes and Inheritance

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.


Table of Contents

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

1. Project Overview

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

2. Key Learning Objectives

  • Implement inheritance using a base Vehicle class 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

3. Class Structure

3.1 Vehicle Class (Base Class)

The Vehicle class contains attributes common to all vehicles.

3.1.1 Attributes

  • make
  • model
  • year
  • weight
  • needsMaintenance (boolean, default = false)
  • tripsSinceMaintenance (int, default = 0)

3.1.2 Methods

repair()

public void repair() {
    tripsSinceMaintenance = 0;
    needsMaintenance = false;
}

Resets the maintenance state of the vehicle.

3.2 Car Class (Derived Class)

The Car class extends Vehicle.

3.2.1 Additional Attributes

  • isDriving (boolean)
  • horsepower (int)

3.2.2 Methods

  • drive()
    • Sets isDriving = true
  • stop()
    • Sets isDriving = false
    • Increments tripsSinceMaintenance

Maintenance rule:

If tripsSinceMaintenance > 100needsMaintenance = true

3.3 Plane Class (Derived Class)

The Plane class also extends Vehicle.

3.3.1 Additional Attributes

  • isFlying (boolean)
  • wingspan (float)

3.3.2 Methods

  • fly()
    • Allowed only when needsMaintenance == false
    • Otherwise prints a warning message and prevents takeoff
  • land()
    • Sets isFlying = false
    • Increments tripsSinceMaintenance

Maintenance rule:

If tripsSinceMaintenance > 80needsMaintenance = true

About

Java project demonstrating object-oriented programming concepts through a vehicle class hierarchy using inheritance and method overriding (Software Development Methodologies, UNIWA).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages