Advertisement
C-Squared

Chapter 5 Project

Nov 19th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1. //Cameron Craik
  2. //Block D
  3. public class Year
  4. {
  5.    
  6.     public static void main(String args[])
  7.     {
  8.             YearToo CurrentYear = new YearToo();
  9.             CurrentYear.NumberInfo(2000);
  10.            
  11.             System.out.println(CurrentYear.getIfLeapYear());
  12.            
  13.     }
  14.  
  15. }
  16. ------------------------------------------------------------
  17. public class YearToo
  18. {
  19.     private boolean Leap;
  20.     private int num;
  21.    
  22.     public int NumberInfo(int num)
  23.     {
  24.              return num;
  25.     }
  26.        
  27.         public boolean getIfLeapYear()
  28.         {
  29.                 if(num%4 == 0)
  30.                 {
  31.                         if(num%100 == 0)
  32.                         {
  33.                         Leap = false;
  34.                         return Leap;
  35.                         }
  36.                         else
  37.                         {
  38.                                 Leap = true;
  39.                                 return Leap;
  40.                         }
  41.                 }
  42.                 else
  43.                 {
  44.                         Leap = false;
  45.                         return Leap;
  46.                 }
  47.                
  48.         }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement