/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package elsoexire; /** * * @author Razuro */ public class Datum { private int ev = 2010; private int honap = 10; private int nap = 13; public Datum() { this.ev = 2010; this.honap = 10; this.nap = 13; } public Datum(int ev ,int honap, int nap) { //return ( $y % 4 == 0 && ( $y % 100 != 0 || $y % 400 == 0 ) )? true : false; setEv(ev); setHonap(honap); setNap(nap); } public void setEv(int ev) { if(ev >= 1 & ev <= 3000){ this.ev = ev; } } public void setHonap(int honap) { if(honap >= 1 & honap <= 12){ this.honap = honap; } } public void setNap(int nap) { if(((this.ev % 4 == 0 && ( this.ev % 100 != 0 || this.ev % 400 == 0 )) == true) & (this.honap == 2) ){ if(nap >= 1 & nap <= 29){ this.nap = nap; }else{ this.nap = 0; } } if(nap >= 1 & nap <= 31){ if((this.honap <= 6) & nap <= 30 & this.honap != 2){ this.nap = nap; } else if(this.honap >= 7 & nap <= 30) { this.nap = nap; } else if((nap < 28) & this.honap == 2) { this.nap = nap; } } else if(this.honap %2 != 0){ if((this.honap >= 8 ) & nap <= 30){ this.nap = nap; } if(this.honap <= 7){ this.nap = nap; } } } } @Override public String toString() { return "Datum{" + "ev=" + ev + "honap=" + honap + "nap=" + nap + '}'; } }
Wednesday, October 13, 2010
Test Java 01
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment