السلام عليكم
كيفكم؟؟
انا عضوه جديده هنا واتمنى تساعدوني في الاسايمنت مالي
كتبت هذا البرنامج لحساب العمر ولكن الدكتور قالي ان يحتاج تعديل مثل اضافه if لكل شهر بمعني راح تكون عندنا 12 if بوضع في الاعتبار السنه الكبيسه
عموما هذا هو البرنامج ولو سمحتوا اريد توضيح اكثر
//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");
}
}اتمنى الرد باسرع وقت لان المشروع لازم نسلمه خلال السبوع القادم ان شاء الله
