Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Curso de Java Netbeans Completo☕ [61.- (POO) Polimorfismo]
Video: https://youtu.be/j_e2YPjWNns
- Loading branch information
1 parent
ec13ecf
commit 0718772
Showing
11 changed files
with
89 additions
and
45 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
src/main/java/com/programadornovato/proy1/TipoDeportivo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.programadornovato.proy1; | ||
|
||
public class TipoDeportivo extends Vehiculo { | ||
|
||
private int cilindros; | ||
|
||
public TipoDeportivo(String matricula, String marca, String modelo,int cilindros) { | ||
super(matricula, marca, modelo); | ||
this.cilindros=cilindros; | ||
} | ||
|
||
@Override | ||
public String mostrarDatos() { | ||
return "matricula="+this.matricula+" marca="+this.marca+" modelo="+this.modelo+" cilindros="+this.cilindros; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/programadornovato/proy1/TipoFurgoneta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.programadornovato.proy1; | ||
|
||
public class TipoFurgoneta extends Vehiculo { | ||
|
||
private int carga; | ||
|
||
public TipoFurgoneta(String matricula, String marca, String modelo,int carga) { | ||
super(matricula, marca, modelo); | ||
this.carga=carga; | ||
} | ||
|
||
@Override | ||
public String mostrarDatos() { | ||
return "matricula="+this.matricula+" marca="+this.marca+" modelo="+this.modelo+" carga="+this.carga; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/programadornovato/proy1/TipoTurismo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.programadornovato.proy1; | ||
|
||
public class TipoTurismo extends Vehiculo { | ||
|
||
private int numeroPuertas; | ||
|
||
public TipoTurismo(String matricula, String marca, String modelo,int numeroPuertas) { | ||
super(matricula, marca, modelo); | ||
this.numeroPuertas=numeroPuertas; | ||
} | ||
|
||
@Override | ||
public String mostrarDatos() { | ||
return "matricula="+this.matricula+" marca="+this.marca+" modelo="+this.modelo+" numeroPuertas="+this.numeroPuertas; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.programadornovato.proy1; | ||
|
||
public class Vehiculo { | ||
|
||
protected String matricula; | ||
|
||
protected String marca; | ||
|
||
protected String modelo; | ||
|
||
public Vehiculo(String matricula, String marca, String modelo) { | ||
this.matricula = matricula; | ||
this.marca = marca; | ||
this.modelo = modelo; | ||
} | ||
|
||
public String getMatricula() { | ||
return matricula; | ||
} | ||
|
||
public String getMarca() { | ||
return marca; | ||
} | ||
|
||
public String getModelo() { | ||
return modelo; | ||
} | ||
|
||
public String mostrarDatos() { | ||
return "matricula="+this.matricula+" marca="+this.marca+" modelo="+this.modelo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters