• بادئ الموضوع بادئ الموضوع H.H.H
  • تاريخ البدء تاريخ البدء
بارك الله في وقتك وجهدك .. تم التطبيق..
 

الله يعطيك العافية ومأجور إن شاء الله..

الآن عرفت قيمة هذه اللغة بشكل أكبر... لك جزيل الشكر على اخلاصك
 
بارك الله فيك يا بطل ..
تم التقيم .. و 5/5 ,,
تحيتي ,,
 
توقيع : ISLAM LEE
أرجوك لاتتوقف كما هي الحال في المنتديات الأخرى :(

ننتظر بشوق..
 
4fa839d11e1b5dea7106e848d0df8ec7.png


d5d706e2f97d2d5a099236018d650ec9.png


فاصل2

الحمدلله والصلاة والسلام على نبينا محمد صلى الله
عليه وسلم أما بعد


نعود مرة اخرى لنكمل سلسلة الدروس في هذه اللغة
وكلنا شوق الى اتقانها باذن الله .

الدرس اليوم كما سبق اعلانه في الدرس الماضي
هو عن
Math Classes
فهو ينتمي الى

import java.lang.Math;


Math Classes

عبارة عن أوامر الرياضيات ودوالها
لنستطيع استخدامها في المعادلات.
للمعلومية سواء كتبنا او لم نكتب
البرنامج سيتعرف على الدوال
لماذا؟؟؟
لان البرنامج NetBeans يشغلها دائما في الخفاء
لذلك لايعطيك خطأ اذا لم تكتبها .

ياليت تجربون لتتأكدوا



واليكم الصورة لتوضح ابرز الدوال

874586044fdec684d5564a1c24c36fff.png


الصيغة الرسمية لها
Math.
بعد الدوت نكتب الدالة او الامر
6493b47425d0bb45e88347a52dda49d6.png

يستخدم للأس
a : العدد
b: الاس

7c5d848bc6312a5e3253dd6a0a96623b.png

الجذر التربيعي لما بداخل الاقواس
f7ec83c467bea0d6d72e4f6ac7e296f3.png

احدى الدوال المثلثية
c7014ed20e6cec4230c8ec1518772b24.png

ايجاد العدد الاكبر من بين العددين
اللي بين الاقواس

e57921641858002170e96209300f4c0d.png

اللوغاريتم للعدد a

هذه بعض الدوال والادوات الرياضية السهلة لكي نستخدمها
ويوجد الكثير منها التي لم نتطرق لها .


بعد ان تعرفنا على بعض الدوال الرياضية
أتى وقت التطبيق

6f21536ff638b5481ccdbe4e6fbea1b2.gif


المثال 1
ندخل العدد والاس لايجاد ناتجهما

3b2e092dd68d4b9769b3542396587022.png



المثال 2
ايجاد الجذر التربيعي

c7a11c0534b1e5fd77c420516a126266.png



وبهذه الأمثلة نختم درسنا لهذا اليوم

والسلام عليكم ورحمة الله وبركاته



 
تطبيق القسمة و الكاستينغ
كود:
[LEFT] package casting;
import javax.swing.*;
/**
 *
 * @author LEADER2008
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
           String number_str;
           double  number;
           int cast;
       number_str = JOptionPane.showInputDialog(null," أدخل عدد ");
       
       number=(Integer.parseInt(number_str))/22.4;
       cast=(int)number;

       JOptionPane.showMessageDialog(null, " حاصل قسمة "+number_str+"على 22.4"+"\n"+number+"\n casting  : \n"+ cast);


    }

}
[/LEFT]

نتيجة التطبيق

81833e4fcb427da632c331382f7caf51.png

 
ما الخطا هنا


package personalinformation;
import javax.swing.*;
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String Name,Job,Address,Status;
int Age,CellPhone,
JOptionPane.showMessageDialog(null,"Its a New Erra");
Name=JOptionPane.showInputMessage(null," What is Your Name?");
Job=JOptionPane.showInputMessage(null," Who Do You Work For? ");
Age=JOptionPane.showInputMessage(null," How Old Are You? ");
Address=JOptionPane.showInputMessage(null," Where Do Ypu Live? ");
Status=JOptionPane.showInputMessage(null," Are you Married Or Single");
Cellphone=JOptionPane.showInputMessage(null," Can I Have Your CellPhone Number ,pLease ?")
JOptionPane.showMessageDialog(null,"Im"+Name+"Live in"+Address+","+"Im "+Age+"and work as "+Job+",Finally,Im "+Status+".My CellPhone Number is: "+CellPhone+".");
JOptionPane.showMessageDialog(null,"Thanks alot, Data is saved successfully !");
JOptionPane.showMessageDialog(null,"Best Greetings. \n"+" Yours Sincerely,"+" AppleMAc");
 
توقيع : burner
ما الخطا هنا


package personalinformation;
import javax.swing.*;
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String Name,Job,Address,Status;
int Age,CellPhone,
JOptionPane.showMessageDialog(null,"Its a New Erra");
Name=JOptionPane.showInputMessage(null," What is Your Name?");
Job=JOptionPane.showInputMessage(null," Who Do You Work For? ");
Age=JOptionPane.showInputMessage(null," How Old Are You? ");
Address=JOptionPane.showInputMessage(null," Where Do Ypu Live? ");
Status=JOptionPane.showInputMessage(null," Are you Married Or Single");
Cellphone=JOptionPane.showInputMessage(null," Can I Have Your CellPhone Number ,pLease ?")
JOptionPane.showMessageDialog(null,"Im"+Name+"Live in"+Address+","+"Im "+Age+"and work as "+Job+",Finally,Im "+Status+".My CellPhone Number is: "+CellPhone+".");
JOptionPane.showMessageDialog(null,"Thanks alot, Data is saved successfully !");
JOptionPane.showMessageDialog(null,"Best Greetings. \n"+" Yours Sincerely,"+" AppleMAc");


بعد إذن الإشراف و الأخ صاحب الدورة H.H.H أقدم لك أخي ملاحظاتي

637ac3812b5a0d28875d84ed652d2034.png

و الكود الصحيح عليك تجريبه أخي



كود:
[LEFT]import javax.swing.*;
/**
 *
 * @author LEADER2008
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       String Name,Job,Address,Status;
int Age,CellPhone;
JOptionPane.showMessageDialog(null,"Its a New Erra");
Name=JOptionPane.showInputDialog(null," What is Your Name?");
       
Job=JOptionPane.showInputDialog(null," Who Do You Work For? ");
Age=Integer.parseInt(JOptionPane.showInputDialog(null," How Old Are You? "));
Address=JOptionPane.showInputDialog(null," Where Do Ypu Live? ");
Status=JOptionPane.showInputDialog(null," Are you Married Or Single");
CellPhone=Integer.parseInt(JOptionPane.showInputDialog(null," Can I Have Your CellPhone Number ,pLease ?"));
JOptionPane.showMessageDialog(null,"Im"+Name+"Live in"+Address+","+"Im "+Age+"and work as "+Job+",Finally,Im "+Status+".My CellPhone Number is: "+CellPhone+".");
JOptionPane.showMessageDialog(null,"Thanks alot, Data is saved successfully !");
JOptionPane.showMessageDialog(null,"Best Greetings. \n"+" Yours Sincerely,"+ "AppleMAc");
         
  }

}

[/LEFT]


 
... .. .. .. كنت بصحح بس شفت الأخ ماشاء الله ما قصر..
....
 
يعطيك العافية اخ leader ع التصحيح


بالمناسبة اشكر الاخ burner

لانه نبهني على خطأ عملته في الدرس الخامس

لهذا السبب قمت بتعديل الدرس الخامس

وشكراااا
 
لدي سؤال في الجافا، هل يمكنني طرحه هنا أم يوجد قسم للأسئلة؟
.
.

السؤال هو:
كيف أقرأ نص طويل مكون من 5 أسطر مثلاً باستخدام الواجهات ؟وأين أخزنه؟

أنا أحتاج أقرأه من اليوزر ثم أظهره له مره أخرى ولكن للقراءة فقط لايستطيع التعديل عليه..
 
شكرا يا ليدر على الجواب الصحيح
 
توقيع : burner
حياك الله اخ اتش اتش اتش
 
توقيع : burner
عدلت عليه وما زال هنااك خطأ

كود:
package personalinformation;
import javax.swing.*;
public class Main {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       String Name,Job,Address,Status;
      int Age,CellPhone;
      String insage,inscell;
      Age=Integer.parseInt(insage);
      CellPhone=Integer.parseInt(inscell);
       JOptionPane.showMessageDialog(null,"Its a New Erra");
      Name=JOptionPane.showInputDialog(null," What is Your Name?");
      Job=JOptionPane.showInputDialog(null," Who Do You Work For? ");
       Age=JOptionPane.showInputDialog(" How Old Are You? ");
       Address=JOptionPane.showInputDialog(null," Where Do Ypu Live? ");
      Status=JOptionPane.showInputDialog(null," Are you Married Or Single");
        CellPhone=JOptionPane.showInputDialog(" Can I Have Your CellPhone Number ,please ?");
        JOptionPane.showMessageDialog(null,"Im"+Name+"Live in"+Address+","+"Im "+Age+"and work as "+Job+",Finally,Im "+Status+".My CellPhone Number is: "+CellPhone+".");
        JOptionPane.showMessageDialog(null,"Thanks alot, Data is saved successfully !");
        JOptionPane.showMessageDialog(null,"Best Greetings. \n"+" Yours Sincerely,"+" AppleMAc");

    }
 
توقيع : burner
عدلت عليه وما زال هنااك خطأ

كود:
package personalinformation;
import javax.swing.*;
public class Main {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       String Name,Job,Address,Status;
      int Age,CellPhone;
      String insage,inscell;
      Age=Integer.parseInt(insage);
      CellPhone=Integer.parseInt(inscell);
       JOptionPane.showMessageDialog(null,"Its a New Erra");
      Name=JOptionPane.showInputDialog(null," What is Your Name?");
      Job=JOptionPane.showInputDialog(null," Who Do You Work For? ");
       Age=JOptionPane.showInputDialog(" How Old Are You? ");
       Address=JOptionPane.showInputDialog(null," Where Do Ypu Live? ");
      Status=JOptionPane.showInputDialog(null," Are you Married Or Single");
        CellPhone=JOptionPane.showInputDialog(" Can I Have Your CellPhone Number ,please ?");
        JOptionPane.showMessageDialog(null,"Im"+Name+"Live in"+Address+","+"Im "+Age+"and work as "+Job+",Finally,Im "+Status+".My CellPhone Number is: "+CellPhone+".");
        JOptionPane.showMessageDialog(null,"Thanks alot, Data is saved successfully !");
        JOptionPane.showMessageDialog(null,"Best Greetings. \n"+" Yours Sincerely,"+" AppleMAc");

    }
أخي الكريم لا شكر على واجب و تحيتي لك لـ
أنت استعملت طريقة أخرى

أنسخ هذا الكود و حاول المقارنة إن شاء الله صحيح


كود:
[LEFT]  public static void main(String[] args) {
        // TODO code application logic here
[COLOR=Blue]String[/COLOR] [COLOR=DarkOrange]Name,Job,Address,Status,insage,inscell;[/COLOR]
      [COLOR=Blue]int[/COLOR] [COLOR=DarkGreen]Age,CellPhone[/COLOR];

      JOptionPane.showMessageDialog(null,"Its a New Erra");
     [COLOR=DarkOrange] insage[/COLOR]=JOptionPane.showInputDialog(null," How Old Are You? ");
      [COLOR=DarkGreen]Age[/COLOR]=Integer.parseInt(insage);
     [COLOR=DarkOrange] inscell[/COLOR]=JOptionPane.showInputDialog(null," Can I Have Your      CellPhone Number ,please ?");
      [COLOR=DarkGreen]CellPhone[/COLOR]=Integer.parseInt(inscell);
      //Age=Integer.parseInt(insage);
     
      [COLOR=DarkOrange]Name[/COLOR]=JOptionPane.showInputDialog(null," What is Your Name?");
      [COLOR=DarkOrange]Job[/COLOR]=JOptionPane.showInputDialog(null," Who Do You Work For? ");
      
       //Age=JOptionPane.showInputDialog(" How Old Are You? ");
      [COLOR=DarkOrange] Address[/COLOR]=JOptionPane.showInputDialog(null," Where Do Ypu Live? ");
       [COLOR=DarkOrange]Status[/COLOR]=JOptionPane.showInputDialog(null," Are you Married Or Single");
       
        //CellPhone=JOptionPane.showInputDialog(" Can I Have Your CellPhone Number ,please ?");
        JOptionPane.showMessageDialog(null,"Im"+Name+"Live in"+Address+","+"Im "+Age+"and work as "+Job+",Finally,Im "+Status+".My CellPhone Number is: "+CellPhone+".");
        JOptionPane.showMessageDialog(null,"Thanks alot, Data is saved successfully !");
        JOptionPane.showMessageDialog(null,"Best Greetings. \n"+" Yours Sincerely,"+" AppleMAc");

    
    }



}
   
[/LEFT]
 
[RIGHT]
[/RIGHT]

ملاحظة : أنت كنت قد عرفت متغيرين وسطيين جديدين و هما insage و inscell نوع string
و حينما تقوم بتحويل تستعمل عبارة قصيرة ليست كعبارتي طويلة و لكنها صحيحة فهذا لأنك أكثر منهجية و تنظيم مني :d:
يجب عليك تسجيل الدخول او تسجيل لمشاهدة الرابط المخفي

يجب عليك تسجيل الدخول او تسجيل لمشاهدة الرابط المخفي


 
تطبيق الدرس الثامن
هذا التطبيق يحسب لنا حاصل قوة عدد بعدد
استعمال Math.pow
و استعمال خاصية Math.random
و استعمال Math.sqrt
مع استعمال sqrt إلا مع الأعداد الصحيحة (integer) الموجبة
كود:
[LEFT]
 public static void main(String[] args) {
        // TODO code application logic here
        String str1,str2;
        Double n,n1,n2,n3,n4;
        int n5;
        str1=JOptionPane.showInputDialog(null,"الرجاء إدخال عدد");
        str2=JOptionPane.showInputDialog( null,"الرجاء إدخال العدد الثاني ");
        n1=Double.parseDouble(str1);
        n2=Double.parseDouble(str2);
        n=Math.pow(n1,n2);
        n3=Math.sqrt(n);
        n4=Math.random()*10;
        

        JOptionPane.showMessageDialog(null, "حاصل "+" "+n1+" "+"قوة"+" "+n2+" "+"هــو" + " "+n);
        JOptionPane.showMessageDialog(null, "الجذر التربيعي للعدد "+ " "+n+" "+"هو" +" "+n3);
        JOptionPane.showMessageDialog(null,"عدد عشري عشوائي "+ " "+n4);




    }

}

[/LEFT]
e46343318985d8b236cbbbcb971f0b74.gif

 
يعطيكم العافيه وبارك الله فيكم ...
 
توقيع : زرياب10
مع اني اخدتدورة جافا
ولكن نسيتها
وانتو اساتذتي
والله يخليكم
 
توقيع : burner
عودة
أعلى