package com.trifulcas.Interfaces; public interface ISaludo { public String saludar(); } package com.trifulcas.Interfaces; public interface IDespedida { public String adios(); } package com.trifulcas.Interfaces; public class Amigo1 implements ISaludo { @Override public String saludar() { // TODO Auto-generated method stub return "Ola k ase???"; } } package com.trifulcas.Interfaces; public class Amigo2 implements IDespedida{ @Override public String adios() { // TODO Auto-generated method stub return "Adios con el corazón"; } } package com.trifulcas.Interfaces; public class Amigo1 implements ISaludo { @Override public String saludar() { // TODO Auto-generated method stub return "Ola k ase???"; } } package com.trifulcas.Interfaces; public class Amigo2 implements IDespedida{ @Override public String adios() { // TODO Auto-generated method stub return "Adios con el corazón"; } } package com.trifulcas.Interfaces; public class Amigo3 implements ISaludo, IDespedida { @Override public String adios() { // TODO Auto-generated method stub return "Hasta luego Lucas"; } @Override public String saludar() { // TODO Auto-generated method stub return "Como están los máquinas?"; } } package com.trifulcas.Interfaces; public interface ITotal { public int total(); } package com.trifulcas.Interfaces; import java.util.ArrayList; import com.trifulcas.cartas.Carta; public class Notas implements ITotal { private ArrayList<Integer> notas; public Notas() { notas=new ArrayList<>(); } public int addNumero(int nota) { notas.add(nota); return notas.size(); } @Override public int total() { int total=0; for(int nota:notas) { total+=nota; } return total; } } package com.trifulcas.Interfaces; import java.util.ArrayList; public class Alumno implements ITotal, ISaludo { public ArrayList<String> alumnos; public Alumno() { alumnos=new ArrayList<>(); } @Override public String saludar() { return "Hola "+(alumnos.size()>0?alumnos.get(0):""); } @Override public int total() { // TODO Auto-generated method stub return alumnos.size(); } } package com.trifulcas.Interfaces; public interface IFigura { public void dibujar(); } package com.trifulcas.Interfaces; public interface IFigura2D extends IFigura { public double area(); } package com.trifulcas.Interfaces; public interface IFigura3D extends IFigura2D{ public double volumen(); } package com.trifulcas.Interfaces; public class Cuadrado implements IFigura2D { private double lado; protected double getLado() { return lado; } protected void setLado(double lado) { this.lado = lado; } public Cuadrado(double lado) { this.lado=lado; } @Override public double area() { // TODO Auto-generated method stub return lado*lado; } @Override public void dibujar() { System.out.println("Cuadrado"); } }