الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

برنامج تضع فيه اي تاريخ فيظهر في اي يوم ذلك التاريخ مع ميزات اخرى

مغلق
بدأه mofeed chaar في 17 أكتوبر 2006 · 3 رد · 505 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

اليكم ذلك البرنامج الذي يحول التاريخ للهجري مع اظهار اليوم و ميزة تعديل التاريخ بشكل تلقائي ان كتبت التاريخ بشكل خاطئ

import java.util.Scanner;


public class DateTest
{
	public static void main(String[] arii)
	{

		int doe[] = { 0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 };

		Scanner input = new Scanner(System.in);

		System.out.println("inter the year");

		Hejrah hejri = new Hejrah();

		int yea = input.nextInt();

		System.out.println("inter the mounth");

		int mou = input.nextInt();


		if(mou <= 0 || mou > 12 )

			mou = 12;


		System.out.println("inter the day");

		int da = input.nextInt();


		if(yea%4==0&& mou == 2 && (da <= 0 || da > 28))

			da = 29;


		if((da <= 0 || da > doe[mou])&&yea%4 !=0)

			da = doe[mou];


		if(yea%4==0&& mou != 2 && (da <= 0 || da > doe[mou]))

			da = doe[mou];



			Date date = new Date(yea,mou,da);

	System.out.print("this date is "+yea+"/"+date.mounth+"/"+date.day+"\n");

	System.out.println(date.cabeesa());

	System.out.println("hejra is "+hejri.hej(yea));


	int day2 = 0;
	int day3 = 0;
	String day4;



	for(int day1 =0;day1 < mou; day1++){

		day2 += doe[day1];

	}
	if(yea>=0)
	{
		if (yea % 4 == 0)

		{
			if ((mou >= 3))

				day2 +=yea / 4;

			else

			if (yea != 0)

				day2 += yea / 4 - 1;
		}
		else

			day2 += yea / 4;

		if ((yea > 0) ||
			(yea == 0 && ((mou >= 3))))

			day2++;

		day3 = day2 +yea*365+ da;

	}

	switch (day3%7)
	 {
	 case 1 :
	   day4="friday";
	   break;
	   case 2 :
		   day4 = "saturday";
		   break;
		   case 3 :
			   day4 ="sunday";
			   break;
			   case 4 :
				   day4="monday";
				   break;
				   case 5 :
					 day4 = "tuseday";
					   break;
					   case 6 :
						   day4 = "wednsday";
						   break;
						   default :
							   day4="thursday";
							   break;
	 }

   System.out.println("the day is: "+day4);

   System.out.println("if you want continu press(1) or press(2) to exit:");

   int ho = input.nextInt();

   while(ho!=2)

   {

	 if (ho == 1)

	 {

	   DateTest.main(arii);

	 }// end if

	 System.out.println("if you want continu press(1) or press(2) to exit:");

	 ho = input.nextInt();

   }// end while


  }// end main

   static class Date

   {

	   int year;
	   int mounth;
	   int day;
	   String cab;


	   // constructor
	   public  Date(int yy,int mm,int dd)
	   {

		   year = yy;
		   mounth = mm;
		   day = dd;

	   }// end constructor Date


	   public String cabeesa()

	   {
		   if(year%4 == 0)

		   {

			   cab = "this year is cabeesa";

		   }// end if

		   else

			   cab = "this year is,nt cabeesa";

		   return cab;

	   } // end method cabeesa


   } // end class Date

   static class Hejrah
   {
	   int he;

	   public int hej(int mi)
	   {

		   he = (1427*(mi-622))/(1384);

		   return he;

	   } // end method hej


   } // end class Hejrah


}// end class DateTest

mofeedchaar@hotmail.com

#2

بارك الله بك ضع كل امثلتك في موضوع واشرحها افضل من البرامج الجاهزة

لست متواجد بشكل يومي

#3

شكرا يا اخي على البرنامج

#4

ياريت تبقى وانت بتكتب البرنامج ابقى حط comments بين السطور علشان توضحلك وتوضحلنا الكود المكتوب ده بيعمل ايه

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…