النتائج 1 إلى 2 من 2

الموضوع: مساعدة في حل سؤال في لغة برمجة الجافا ضروري جداً جداً جداً

  1. #1
    عضوية جديدة
    تاريخ التسجيل
    Nov 2012
    المشاركات
    6
    معدل تقييم المستوى
    0

    Post مساعدة في حل سؤال في لغة برمجة الجافا ضروري جداً جداً جداً

    السلام عليكم ورحمة الله وبركاته
    الرجاء مساعدتي في السؤال التالي الموجود في نهاية الموضوع
    وعند الانتهاء من الحل الرجاء استخدام GUI(Graphic User Interface) واستخدام الـ Intrface ليكون الحل مرتباً يعني اظهار صندوق حوار لندخل رقم واخراج الناتج وايضاً استخدام error detection
    البرنامج يطلب مني ادخل له عملية حسابية يعني يطلع لي رسالة يقول لي please input your string وانا ادخل له العملية الحسابية
    ويظهر لي في شاشة المخرجات التالي:
    the postfix is:-
    the result is:-
    يعني لو أدخلت العملية الحسابية التالية :- 5+2*(7-3)-4 يطلع لي في شاشة المخرجات
    the postfix is 5273-*+4-h
    the result is 9
    يمكن هذا الموقع يكون للمساعدة في الحل https://interactivepython.org/course...lst-stackcode2
    الرجاء أريد الحل لانه يجب علي تسليم الحل للدكتور يوم الأحد 18/11/2012 وحتى يكون لي الوقت حتى أفهم الحل



    Write a full program in JAVA using stack implementation toconvert an infix expression to postfix; your program should evaluate thepostfix expression.
    The following display the steps for conversion andevaluation.
    Conversionfrom infix to postfix algorithem*

    Create an empty stack called opstack for keeping operators. Create an empty list for output.
    Convert the input infix string to a list by using the string methodsplit.

    Scan the token list from left to right.
    If the token is an operand, append it to the end of the output list.

    If the token is a left parenthesis, push it on the opstack.
    If the token is a right parenthesis, pop the opstack until the corresponding left parenthesis is removed. Append each operator to the end of the output list.
    If the token is an operator, *, /, +, or -, push it on theopstack. However, first remove any operators already on theopstack that have higher or equal precedence and append them to the output list.
    When the input expression has been completely processed, check theopstack. Any operators still on the stack can be removed and appended to the end of the output list.
    The figure below shows the conversion algorithm working on the expression A * B + C * D. Note that the first * operator is removed upon seeing the + operator. Also, + stays on the stack when the second * occurs, since multiplication has precedence over addition. At the end of the infix expression the stack is popped twice, removing both operators and placing + as the last operator in the postfix expression

    https://interactivepython.org/course...s/intopost.png

    PostfixEvaluation algorithm*

    https://interactivepython.org/course...alpostfix1.png


    https://interactivepython.org/course...alpostfix2.png



    Assume the postfix expression is a string of tokens delimited by spaces. The operators are *, /, +, and - and the operands are assumed to be single-digit integer values. The output will be an integer result.
    Create an empty stack called operandStack.
    Convert the string to a list by using the string method split.
    Scan the token list from left to right.
    If the token is an operand, convert it from a string to an integer and push the value onto the operandStack.
    If the token is an operator, *, /, +, or -, it will need two operands. Pop the operandStack twice. The first pop is the second operand and the second pop is the first operand. Perform the arithmetic operation. Push the result back on theoperandStack.
    When the input expression has been completely processed, the result is on the stack. Pop the operandStack and return the value.
    التعديل الأخير تم بواسطة shining19931 ; 15-11-2012 الساعة 22:50

  2. #2
    عضوية جديدة
    تاريخ التسجيل
    Nov 2012
    المشاركات
    6
    معدل تقييم المستوى
    0

    رد: مساعدة في حل سؤال في لغة برمجة الجافا ضروري جداً جداً جداً

    يعني رجاءً منكم حلوا السؤال انا طلبت كود ما طلبت معجزة
    يعني ما شاء الله 101 شاهدوا الموضوع ما بيعرفوا يكتبوا كود نهائياً؟ يعني أنا ما طلبت شئ مستحيل
    يعني رجاءً حار منكم يللي بيعرف الحل يكتب الحل بالرد
    التعديل الأخير تم بواسطة shining19931 ; 15-11-2012 الساعة 22:52

المفضلات

ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •