Advertisement
Guest User

Untitled

a guest
May 26th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. abstract class Automjeti{
  2.  
  3. private String prodhuesi;
  4. private int cmimi;
  5.  
  6. public Automjeti(String p, int c){
  7. prodhuesi = p;
  8. cmimi = c;
  9. }
  10.  
  11. public void setProdhuesi(String s){
  12. prodhuesi = s;
  13. }
  14. public void setCmimi(int cmimi){
  15. this.cmimi = cmimi;
  16. }
  17.  
  18. public int getCmimi(){
  19. return cmimi;
  20. }
  21. public String getProdhuesi(){
  22. return prodhuesi;
  23. }
  24.  
  25. abstract boolean eshteAutomatik();
  26.  
  27. public String toString(){
  28.  
  29. return prodhuesi + " - " + cmimi + " euro";
  30.  
  31. }
  32.  
  33. public boolean equals(Object o){
  34.  
  35. if(this == o){
  36. return true;
  37. }else if (o == null){
  38. return false;
  39. }
  40.  
  41. if(o instanceof Automjeti){
  42.  
  43. Automjeti a = (Automjeti) o;
  44.  
  45. if(a. getCmimi() == cmimi && a.getProdhuesi().equals(prodhuesi)){
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement