> For the complete documentation index, see [llms.txt](https://educacion.gitbook.io/programacion/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://educacion.gitbook.io/programacion/exercicios-java/ud5-exercicios/interfaces.md).

# Interfaces

1. Define as seguintes clases:
   1. Unha clase Vehículo con un atributo matricula que implemente un método mover, que unicamente mostrara por pantalla a seguinte mensaxe: O vehiculo estas movendo
   2. Unha clase VehiculoElectrico con un atributo batería, que indica o porcentaxe de carga da mesma, e que redefina o método moverse indicando que o VehiculoElectrico estase movendo
   3. Unha clase VehiculoGasolina con un atributo deposito, que indica os litros de carburante que garda no deposito, e que redefina o método moverse indicando que o VehiculoGasolina estase movendo
   4. Unha clase MotoElectrica que herde de VehiculoElectrico, e que redefina o método moverse indicando que o MotoElectrica estase movendo
   5. Crea unha interface Eléctrico cun método cargar()
   6. Modifica as clases VehiculoElectrico e Moto eléctrica para que implementen Eléctrico, simplemente mostrando unha mensaxe que indique que o "VehiculoElectrico/MotoElectrica está a cargar".
   7. Crea unha clase App con un main, na que:
      1. Crea un obxecto de cada una das clases anteriores
      2. Crea un Array de tipo Vehiculo, engade todos os obxectos, e chama a mover()
      3. Crea un Array de tipo Electrico, engade os obxectos que implementen a interface, e chama a cargar()


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://educacion.gitbook.io/programacion/exercicios-java/ud5-exercicios/interfaces.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
