Advertisement
RazorBlade57

Monster

Nov 16th, 2016
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. //© A+ Computer Science  -  www.apluscompsci.com
  2. //Name -
  3. //Date -
  4. //Class -
  5. //Lab  -
  6.  
  7. import static java.lang.System.*;
  8.  
  9. public class Monster
  10. {
  11.     private String name;
  12.     private int howBig;
  13.  
  14.     public Monster()
  15.     {
  16.         name = "new";
  17.         howBig = "0";
  18.  
  19.     }
  20.  
  21.     public Monster(String n, int size)
  22.     {
  23.  
  24.         name = n;
  25.         howBig = size;
  26.  
  27.     }
  28.  
  29.     public String getName()
  30.     {
  31.         return name;
  32.     }
  33.    
  34.     public int getHowBig()
  35.     {
  36.         return howBig;
  37.     }
  38.    
  39.     public boolean isBigger(Monster other)
  40.     {
  41.         if (howBig < 50){
  42.        
  43.         return false;
  44.        
  45.         }else{
  46.             return true;
  47.         }
  48.     }
  49.    
  50.     public boolean isSmaller(Monster other)
  51.     {
  52.         if (howBig > 50 ){
  53.         return false;
  54.        
  55.         }else{
  56.             return true;
  57.         }
  58.     }
  59.  
  60.     public boolean namesTheSame(Monster other)
  61.     {
  62.         if (isBigger() == isSmaller){
  63.         return false;
  64.         }else{
  65.             return true;
  66.         }
  67.         }
  68.        
  69.    
  70.     public String toString()
  71.     {
  72.         return getHowBig();
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement