Advertisement
Walkerbo

JimmyJamesThePunnisherTest1

Aug 10th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. //   JJX1  - defines class states & behaviors - this is the first class
  2. public class JJX1 {
  3.     //    Each JJX1 has a xsize and ysize
  4.     private int xsize = 5;
  5.     private int ysize = 12;
  6.    
  7.     //   JJX1 constructor - this is an empty constructor as a JJX1 object has pre-set xsize and ysize values
  8.     public JJX1 () {       
  9.     }
  10.  
  11.     //  getters and setters
  12.     public int getXsize() {
  13.         return xsize;
  14.     }
  15.     public void setXsize(int xsize) {
  16.         this.xsize = xsize;
  17.     }
  18.     public int getYsize() {
  19.         return ysize;
  20.     }
  21.     public void setYsize(int ysize) {
  22.         this.ysize = ysize;
  23.     }
  24. }
  25.  
  26. ----------------------------------------------------
  27.  
  28. //JJX2  - defines class states & behaviors
  29. public class JJX2 {
  30.  
  31.     //     Main Method
  32.     public static void main(String[] args) {
  33.        
  34.         //  instantiate an instance of JJX1    
  35.         JJX1 JJX1sum = new JJX1();
  36.        
  37.         //   now make your sum by getting the values from your instance of JJX1
  38.         int z = JJX1sum.getXsize() + JJX1sum.getYsize();
  39.        
  40.         //   printout to console to test
  41.         System.out.println(z);
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement