Advertisement
RiversMakris

Celular.java

Aug 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. public class Celular{
  2.   //attributes
  3.   //object as attribute
  4.   private String modelo;
  5.   private Pantalla pantalla;
  6.   //setters and getters
  7.   private void setModelo(String modelo){
  8.     this.modelo = modelo;
  9.   }
  10.   public String getModelo(){
  11.     return modelo;
  12.   }
  13.   private Pantalla setPantalla(Pantalla pantalla){
  14.     this.pantalla = pantalla;
  15.   }
  16.   public Pantalla getPantalla(){
  17.     return pantalla;
  18.   }
  19.   //constructor with parameters (2)
  20.   public Celular(String modelo, Pantalla pantalla){
  21.     this.modelo = modelo;
  22.     this.pantalla = pantalla;
  23.   }
  24.   //Question: Is this consider a behaviour even with the boolean?
  25.   //How does comparing one phone to the other one works? I have no idea
  26.   public boolean tengoMasPantalla(Celular elOtro){
  27.     return this.getPantalla().getTamanio() >= elOtro.getPantalla().getTamanio();
  28.   }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement