plz help me in my project
Hello
i wrote this program to find the age and when my teacher saw it he said it's true but you have to add 1 (if) for each month that's mean 12 (if) and put in your maind the year that has 28 days in Feb. I don't understand why we need 12(if) and how can i do this program plz help me i need it during this week to submit it ,,,
//this programe will find your age
import java.util.*;
public class Age1{
public static void main(String[] args){
int x,y,z,s,m,k,a,d,r;
String name;
Scanner scan=new Scanner(System.in);
System.out.println("Enter your name");
name=scan.nextLine();
do{
System.out.println("Enter the day of the month your born on");
x=scan.nextInt();
if(x<=0||x>31){
System.out.println("oobs there are no date like this");
}
}while(x<=0||x>31);
do{
System.out.println("Enter the month you born in");
y=scan.nextInt();
if(y<=0||y>31){
System.out.println("oobs there are no date like this");
}
}while(y<=0||y>31);
do{
System.out.println("Enter the year you born in");
z=scan.nextInt();
if(z<=0||z>2011){
System.out.println("oobs there are no date like this");
}
}while(z<=0||z>2011);
do{
System.out.println("Enter the date of today");
s=scan.nextInt();
if(s<=0||s>31){
System.out.println("oobs there are no date like this");
}
}while(s<=0||s>31);
do{
System.out.println("Enter this month");
m=scan.nextInt();
if(m<=0||m>31){
System.out.println("oobs there are no date like this");
}
}while(m<=0||m>31);
do{
System.out.println("Enter this year");
k=scan.nextInt();
if(k<=0||k>2011){
System.out.println("You are not born right now :)");
}
}while(k<=0||k>2011);
r=s-x;
if(r<0){
r=x-s;
}
a=m-y;
if(a<0){
a=y-m;
}
d=k-z;
System.out.println("Dear "+name+" your age is "+d+" year\n and "+a+" month \n and "+r+" day");
}
}