Id: 568990; Nick: n/a; Timestamp: 2009-02-18 20:45:36; Pasted as: Java
Description: n/a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.Scanner;
public class Isdate {
			public static Scanner reader=new Scanner (System.in);
 
				public static void main(String[] args)
	{
				int num1,num2,num3,num4=0;
				char char1;
				System.out.println("Enter year");
				num1=reader.nextInt();
				System.out.println("Enter month");
				num2=reader.nextInt();
				System.out.println("Enter day");
				num3=reader.nextInt();
				if (num2 > 0 && num2 < 13 && num3 > 0 && num3 < 32) {
					if ((num3 == 31) && ((num2==4) || num2==6 || num2==9 || num2==11)) {
						System.out.println("31st of a month with 30 days");
						num4=1;
					}
					if (num3 >= 30 && num2 == 2) {
						System.out.println("February 30th or 31st");
						num4=1;
					}
					if (num2==2 && num3==29 && num1 % 4 != 0) {
						System.out.println("February 29th outside a leap year");
						num3=1;
					}
					if (num4==0) { System.out.println("ok"); }
	}
				else { System.out.println("The month must be 1-12 and the day 1-31"); }
	}
}
Options: New, Download,
;
Copyright © 2006 by Zyberdog - Some rights reserved. (Browse/Disclaimer/Stats/About) - Highlighted with GeSHi
Nothing to see here.