Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package clases_abs;
- public abstract class Libro implements Interfaz, Comparable<Libro>
- {
- private int cantidadhojas;
- public Libro(int CantidadHojas)
- {
- this.cantidadhojas = CantidadHojas;
- }
- public int getCantidadhojas() {
- return cantidadhojas;
- }
- public void setCantidadhojas(int cantidadhojas) {
- this.cantidadhojas = cantidadhojas;
- }
- @Override
- public String toString() {
- // TODO Auto-generated method stub
- return "tus hojas son..."+getCantidadhojas();
- }
- public void metodoComun()
- {
- char mander = 's';
- }
- public abstract double getPrecio();
- @Override
- public void algo() {
- int a = 10;
- }
- @Override
- public int compareTo(Libro o)
- {
- //si son iguales > 0
- if (o.getCantidadhojas() == getCantidadhojas()) return 0;
- if (getCantidadhojas() > o.getCantidadhojas()) return 1;
- if (getCantidadhojas() < o.getCantidadhojas()) return -1;
- return 0;
- }
- @Override
- public boolean equals(Object obj)
- {
- Libro o = (Libro)obj;
- if (o.getCantidadhojas() == getCantidadhojas()) return true;
- else return false;
- }
- @Override
- public int hashCode() {
- // TODO Auto-generated method stub
- return 0;
- }
- }
Add Comment
Please, Sign In to add comment