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

مساعدة في function الاختيار

بدأه richi في 19 أبريل 2010 · 4 رد · 482 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم.

على فرض قام أربعة موزعين بتقديم طلب شراء أجهزة الكترونية من الشركة التي سنصمم لها البرنامج وذلك على الشكل التالي

الكمية المطلوبة (وحدة ) الموزع

10 موزع 1

5 موزع 2

12 موزع 3

4 موزع 4

31 الإجمالي

المجموع الاجمالي للأجهزة المطلوبة من قبل الموزعين هو 31 جهاز

و بفرض يوجد خمسة موردين للشركة وتقدموا بتورد الأجهزة بحسب التالي:

المورد - الكمية - السعر

الأول - 10 - 1000

الثاني - 12 - 1500

اثالث - 18 - 1200

الرابع - 6 - 1300

الخامس - 18 - 1800

عمل البرنامج :

يختار آلياً المورد الأول والثالث والرابع

وذلك لإنهم قدموا أفضل عرض!

هل ممكن المساعدة في كيفية بناء هذا الفنكشن وعلى ماذا تعتمد الفكرة!؟

#2

أختى الكريمه لقد كتبت هذا الكود ولكنه يختار المودرد الأدنى سعرأ فقط حتى الأن

واشاء الله أكمل المطلوب

[VB]

Module Module1
    Dim QSup1 As Integer = 10
    Dim QSup2 As Integer = 12
    Dim QSup3 As Integer = 18
    Dim QSup4 As Integer = 6
    Dim QSup5 As Integer = 18

    Sub Main(ByVal args As String())
        Console.WriteLine("To Select The best Suppliers to purchase 31 unit")
        Console.WriteLine("Enter the Price for Supplier 1")
        Dim P1 As Double = Double.Parse(Console.ReadLine())
        Console.WriteLine("Enter the Price for Supplier 2")
        Dim P2 As Double = Double.Parse(Console.ReadLine())
        Console.WriteLine("Enter the Price for Supplier 3")
        Dim P3 As Double = Double.Parse(Console.ReadLine())
        Console.WriteLine("Enter the Price for Supplier 4")
        Dim P4 As Double = Double.Parse(Console.ReadLine())
        Console.WriteLine("Enter the Price for Supplier 5")
        Dim P5 As Double = Double.Parse(Console.ReadLine())

        Dim P As String = minimum(P1, P2, P3, P4, P5)

        Func("P1", P, QSup1, 1)
        Func("P2", P, QSup2, 2)
        Func("P3", P, QSup3, 3)
        Func("P4", P, QSup4, 4)
        Func("P5", P, QSup5, 5)
    End Sub

    Sub Func(ByVal param1 As String, ByVal param2 As String, ByVal param3 As Integer, ByVal param4 As Integer)
        If (param1 = param2) And (param3 <= 31) Then
            Console.WriteLine("We Select The Supplier {0}", param4)
        End If
    End Sub

    Function minimum(ByVal val1 As Double, ByVal val2 As Double, ByVal val3 As Double, ByVal val4 As Double, ByVal val5 As Double) As String
        If (val1 < val2) And (val1 < val3) And (val1 < val4) And (val1 < val5) Then
            Return "P1"
        ElseIf (val2 < val1) And (val2 < val3) And (val2 < val4) And (val2 < val5) Then
            Return "P2"
        ElseIf (val3 < val1) And (val3 < val2) And (val3 < val4) And (val3 < val5) Then
            Return "P3"
        ElseIf (val4 < val1) And (val4 < val2) And (val4 < val3) And (val4 < val5) Then
            Return "P4"
        ElseIf (val5 < val1) And (val5 < val2) And (val5 < val3) And (val5 < val4) Then
            Return "P5"
        Else
            Return ""
        End If
    End Function


End Module

=============================================================

[C#]

    class Program
    {
        static int QSup1 = 10;
        static int QSup2 = 12;
        static int QSup3 = 18;
        static int QSup4 = 6;
        static int QSup5 = 18;

        static void Main(string[] args)
        {
            Console.WriteLine("To Select The best Suppliers to purchase 31 unit");
            Console.WriteLine("Enter the Price for Supplier 1");
            double P1 = double.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Price for Supplier 2");
            double P2 = double.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Price for Supplier 3");
            double P3 = double.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Price for Supplier 4");
            double P4 = double.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Price for Supplier 5");
            double P5 = double.Parse(Console.ReadLine());

            string P = minimum(P1, P2, P3, P4, P5);

            Func("P1", P, QSup1, 1);
            Func("P2", P, QSup2, 2);
            Func("P3", P, QSup3, 3);
            Func("P4", P, QSup4, 4);
            Func("P5", P, QSup5, 5);
        }

        public static void Func(string param1, string param2, int param3, int param4)
        {
            if ((param1 == param2)& (param3 <= 31))
            {
                Console.WriteLine("We Select The Supplier {0}",param4);
            }
        }

        public static string minimum(double val1, double val2, double val3, double val4, double val5)
        {
            if ((val1 < val2) & (val1 < val3) & (val1 < val4) & (val1 < val5))
            {
                return "P1";
            }
            else if ((val2 < val1) & (val2 < val3) & (val2 < val4) & (val2 < val5))
            {
                return "P2";
            }
            else if ((val3 < val1) & (val3 < val2) & (val3 < val4) & (val3 < val5))
            {
                return "P3";
            }
            else if ((val4 < val1) & (val4 < val2) & (val4 < val3) & (val4 < val5))
            {
                return "P4";
            }
            else if ((val5 < val1) & (val5 < val2) & (val5 < val3) & (val5 < val4))
            {
                return "P5";
            }
            else
            return "";
        }

    }

 وممّا زادنـــي شرفــاً وتيهــاً   **  وكدت بأخمصي أطأ الثريّا

دخولي تحت قولك يا عبادي  **   وأن صيّرت أحمد لي نبيّـاً

#3

ألف شكر وماقصرت

لكن كيف بيكون اختيار جميع الموردين

#4

للرفع

#5

لقد أعدت كتابة البرنامج لتنفيذ المطلوب

أتمنى ان يكون سهل الفهم

[VB]

Module Module1
    Dim QSup1 As Integer = 10
    Dim QSup2 As Integer = 12
    Dim QSup3 As Integer = 18
    Dim QSup4 As Integer = 6
    Dim QSup5 As Integer = 18

    Sub Main(ByVal args As String())
        Console.WriteLine("To Select The best Suppliers to purchase 31 unit")
        Console.WriteLine("Enter the Price for Supplier 1")
        Dim P1 As Double = Double.Parse(Console.ReadLine())
        Console.WriteLine("Enter the Price for Supplier 2")
        Dim P2 As Double = Double.Parse(Console.ReadLine())
        Console.WriteLine("Enter the Price for Supplier 3")
        Dim P3 As Double = Double.Parse(Console.ReadLine())
        Console.WriteLine("Enter the Price for Supplier 4")
        Dim P4 As Double = Double.Parse(Console.ReadLine())
        Console.WriteLine("Enter the Price for Supplier 5")
        Dim P5 As Double = Double.Parse(Console.ReadLine())


        MainFunc(P1, P2, P3, P4, P5)

    End Sub

    Public Sub MainFunc(ByVal param1 As Double, ByVal param2 As Double, ByVal param3 As Double, ByVal param4 As Double, ByVal param5 As Double)
        Dim m As Double = GetMin(param1, param2, param3, param4, param5)
        Dim Q1 As Integer = QSup1
        Dim Q2 As Integer = QSup2
        Dim Q3 As Integer = QSup3
        Dim Q4 As Integer = QSup4
        Dim Q5 As Integer = QSup5

        If (m = param1) And (Q1 <= 31) Then
            Console.WriteLine("We Select The Supplier 1")
            Q1 += QSup2
            m = GetMin(param2, param3, param4, param5)
            If (m = param2) And (Q1 <= 31) Then
                Console.WriteLine("We Select The Supplier 2")
                Q1 += QSup3
                m = GetMin(param3, param4, param5)
                If (m = param3) And (Q1 <= 31) Then
                    Console.WriteLine("We Select The Supplier 3")
                    Q1 += QSup4
                    m = GetMin(param4, param5)
                    If (m = param4) And (Q1 <= 31) Then
                        Console.WriteLine("We Select The Supplier 4")
                        Q1 += QSup5
                        m = GetMin(param5)
                        If (m = param5) And (Q1 <= 31) Then
                            Console.WriteLine("We Select The Supplier 5")

                        End If
                    ElseIf (m = param5) And (Q1 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")
                    End If
                ElseIf (m = param4) And (Q1 <= 31) Then
                    Console.WriteLine("We Select The Supplier 4")
                    Q1 += QSup5
                    m = GetMin(param5)
                    If (m = param5) And (Q1 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")

                    End If
                End If
            ElseIf (m = param3) And (Q1 <= 31) Then
                Console.WriteLine("We Select The Supplier 3")
                Q1 += QSup4
                m = GetMin(param4, param5)
                If (m = param4) And (Q1 <= 31) Then
                    Console.WriteLine("We Select The Supplier 4")
                    Q1 += QSup5
                    m = GetMin(param5)
                    If (m = param5) And (Q1 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")

                    End If
                End If
            End If



        ElseIf (m = param2) And (Q2 <= 31) Then
            Console.WriteLine("We Select The Supplier 2")
            Q2 += QSup1
            m = GetMin(param1, param3, param4, param5)
            If (m = param1) And (Q2 <= 31) Then
                Console.WriteLine("We Select The Supplier 1")
                Q2 += QSup3
                m = GetMin(param3, param4, param5)
                If (m = param3) And (Q2 <= 31) Then
                    Console.WriteLine("We Select The Supplier 3")
                    Q2 += QSup4
                    m = GetMin(param4, param5)
                    If (m = param4) And (Q2 <= 31) Then
                        Console.WriteLine("We Select The Supplier 4")
                        Q2 += QSup5
                        m = GetMin(param5)
                        If (m = param5) And (Q2 <= 31) Then
                            Console.WriteLine("We Select The Supplier 5")

                        End If
                    End If
                    If (m = param5) And (Q2 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")
                    End If
                ElseIf (m = param4) And (Q2 <= 31) Then
                    Console.WriteLine("We Select The Supplier 4")
                    Q2 += QSup5
                    m = GetMin(param5)
                    If (m = param5) And (Q2 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")


                    End If
                End If
            ElseIf (m = param3) And (Q2 <= 31) Then
                Console.WriteLine("We Select The Supplier 3")
                Q2 += QSup4
                m = GetMin(param4, param5)
                If (m = param4) And (Q2 <= 31) Then
                    Console.WriteLine("We Select The Supplier 4")
                    Q2 += QSup5
                    m = GetMin(param5)
                    If (m = param5) And (Q2 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")

                    End If
                End If
                If (m = param5) And (Q2 <= 31) Then
                    Console.WriteLine("We Select The Supplier 5")
                End If
            End If



        ElseIf (m = param3) And (Q3 <= 31) Then
            Console.WriteLine("We Select The Supplier 3")
            Q3 += QSup1
            m = GetMin(param1, param2, param4, param5)
            If (m = param1) And (Q3 <= 31) Then
                Console.WriteLine("We Select The Supplier 1")
                Q3 += QSup2
                m = GetMin(param2, param4, param5)
                If (m = param2) And (Q3 <= 31) Then
                    Console.WriteLine("We Select The Supplier 2")
                    Q3 += QSup4
                    m = GetMin(param4, param5)
                    If (m = param4) And (Q3 <= 31) Then
                        Console.WriteLine("We Select The Supplier 4")
                        Q3 += QSup5
                        m = GetMin(param5)
                        If (m = param5) And (Q3 <= 31) Then
                            Console.WriteLine("We Select The Supplier 5")

                        End If
                    ElseIf (m = param5) And (Q3 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")
                    End If
                ElseIf (m = param4) And (Q3 <= 31) Then
                    Console.WriteLine("We Select The Supplier 4")
                    Q3 += QSup5
                    m = GetMin(param5)
                    If (m = param5) And (Q3 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")

                    End If
                End If
            ElseIf (m = param2) And (Q3 <= 31) Then
                Console.WriteLine("We Select The Supplier 2")
                Q3 += QSup4
                m = GetMin(param4, param5)
                If (m = param4) And (Q3 <= 31) Then
                    Console.WriteLine("We Select The Supplier 4")
                    Q3 += QSup5
                    m = GetMin(param5)
                    If (m = param5) And (Q3 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")

                    End If
                ElseIf (m = param5) And (Q3 <= 31) Then
                    Console.WriteLine("We Select The Supplier 5")
                End If
            End If



        ElseIf (m = param4) And (Q4 <= 31) Then
            Console.WriteLine("We Select The Supplier 4")
            Q4 += QSup1
            m = GetMin(param1, param2, param3, param5)
            If (m = param1) And (Q4 <= 31) Then
                Console.WriteLine("We Select The Supplier 1")
                Q4 += QSup2
                m = GetMin(param2, param3, param5)
                If (m = param2) And (Q4 <= 31) Then
                    Console.WriteLine("We Select The Supplier 2")
                    Q4 += QSup3
                    m = GetMin(param3, param5)
                    If (m = param3) And (Q4 <= 31) Then
                        Console.WriteLine("We Select The Supplier 3")
                        Q4 += QSup5
                        m = GetMin(param5)
                        If (m = param5) And (Q4 <= 31) Then
                            Console.WriteLine("We Select The Supplier 5")

                        End If
                    End If
                    If (m = param5) And (Q4 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")
                    End If
                ElseIf (m = param3) And (Q4 <= 31) Then
                    Console.WriteLine("We Select The Supplier 3")
                    Q4 += QSup5
                    m = GetMin(param5)
                    If (m = param5) And (Q4 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")
                    End If
                End If
            ElseIf (m = param2) And (Q4 <= 31) Then
                Console.WriteLine("We Select The Supplier 2")
                Q4 += QSup3
                m = GetMin(param3, param5)
                If (m = param3) And (Q4 <= 31) Then
                    Console.WriteLine("We Select The Supplier 3")
                    Q4 += QSup5
                    m = GetMin(param5)
                    If (m = param5) And (Q4 <= 31) Then
                        Console.WriteLine("We Select The Supplier 5")

                    End If
                End If
                If (m = param5) And (Q4 <= 31) Then
                    Console.WriteLine("We Select The Supplier 5")
                End If
            End If



        ElseIf (m = param5) And (Q5 <= 31) Then
            Console.WriteLine("We Select The Supplier 5")
            Q5 += QSup1
            m = GetMin(param1, param2, param3, param4)
            If (m = param1) And (Q5 <= 31) Then
                Console.WriteLine("We Select The Supplier 1")
                Q5 += QSup2
                m = GetMin(param2, param3, param4)
                If (m = param2) And (Q5 <= 31) Then
                    Console.WriteLine("We Select The Supplier 2")
                    Q5 += QSup3
                    m = GetMin(param3, param4)
                    If (m = param3) And (Q5 <= 31) Then
                        Console.WriteLine("We Select The Supplier 3")
                        Q5 += QSup4
                        m = GetMin(param4)
                        If (m = param4) And (Q5 <= 31) Then
                            Console.WriteLine("We Select The Supplier 4")

                        End If
                    End If
                    If (m = param4) And (Q5 <= 31) Then
                        Console.WriteLine("We Select The Supplier 4")
                    End If
                ElseIf (m = param3) And (Q5 <= 31) Then
                    Console.WriteLine("We Select The Supplier 3")
                    Q5 += QSup4
                    m = GetMin(param4)
                    If (m = param4) And (Q5 <= 31) Then
                        Console.WriteLine("We Select The Supplier 4")

                    End If
                End If
            ElseIf (m = param2) And (Q5 <= 31) Then
                Console.WriteLine("We Select The Supplier 2")
                Q5 += QSup3
                m = GetMin(param3, param4)
                If (m = param3) And (Q5 <= 31) Then
                    Console.WriteLine("We Select The Supplier 3")
                    Q5 += QSup4
                    m = GetMin(param4)
                    If (m = param4) And (Q5 <= 31) Then
                        Console.WriteLine("We Select The Supplier 4")

                    End If
                End If
                If (m = param4) And (Q5 <= 31) Then
                    Console.WriteLine("We Select The Supplier 4")
                End If
            End If

        End If
    End Sub




    Public Function GetMin(ByVal ParamArray DoubleCollection As Double()) As Double
        Dim min As Double = Double.MaxValue
        For Each i As Double In DoubleCollection
            If i < min Then
                min = i
            End If
        Next

        Return min
    End Function

End Module

[C#]

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleTest2
{
    class Program
    {
        static int QSup1 = 10;
        static int QSup2 = 12;
        static int QSup3 = 18;
        static int QSup4 = 6;
        static int QSup5 = 18;

        static void Main(string[] args)
        {
            Console.WriteLine("To Select The best Suppliers to purchase 31 unit");
            Console.WriteLine("Enter the Price for Supplier 1");
            double P1 = double.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Price for Supplier 2");
            double P2 = double.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Price for Supplier 3");
            double P3 = double.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Price for Supplier 4");
            double P4 = double.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Price for Supplier 5");
            double P5 = double.Parse(Console.ReadLine());


            MainFunc(P1, P2, P3, P4, P5);

        }

        public static void MainFunc(double param1, double param2, double param3, double param4, double param5)
        {
            double m = GetMin(param1, param2, param3, param4, param5);
            int Q1 = QSup1;
            int Q2 = QSup2;
            int Q3 = QSup3;
            int Q4 = QSup4;
            int Q5 = QSup5;

            if ((m == param1) & (Q1 <= 31))
            {
                Console.WriteLine("We Select The Supplier 1");
                Q1 += QSup2;
                m = GetMin(param2, param3, param4, param5);
                if ((m == param2) & (Q1 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 2");
                    Q1 += QSup3;
                    m = GetMin(param3, param4, param5);
                    if ((m == param3) & (Q1 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 3");
                        Q1 += QSup4;
                        m = GetMin(param4, param5);
                        if ((m == param4) & (Q1 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 4");
                            Q1 += QSup5;
                            m = GetMin(param5);
                            if ((m == param5) & (Q1 <= 31))
                            {
                                Console.WriteLine("We Select The Supplier 5");
                            }

                        }
                        else if ((m == param5) & (Q1 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }
                    }
                    else if ((m == param4) & (Q1 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 4");
                        Q1 += QSup5;
                        m = GetMin(param5);
                        if ((m == param5) & (Q1 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }

                    }
                }
                else if ((m == param3) & (Q1 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 3");
                    Q1 += QSup4;
                    m = GetMin(param4, param5);
                    if ((m == param4) & (Q1 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 4");
                        Q1 += QSup5;
                        m = GetMin(param5);
                        if ((m == param5) & (Q1 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }

                    }
                }
            }



            else if ((m == param2) & (Q2 <= 31))
            {
                Console.WriteLine("We Select The Supplier 2");
                Q2 += QSup1;
                m = GetMin(param1, param3, param4, param5);
                if ((m == param1) & (Q2 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 1");
                    Q2 += QSup3;
                    m = GetMin(param3, param4, param5);
                    if ((m == param3) & (Q2 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 3");
                        Q2 += QSup4;
                        m = GetMin(param4, param5);
                        if ((m == param4) & (Q2 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 4");
                            Q2 += QSup5;
                            m = GetMin(param5);
                            if ((m == param5) & (Q2 <= 31))
                            {
                                Console.WriteLine("We Select The Supplier 5");
                            }

                        }
                        if ((m == param5) & (Q2 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }
                    }
                    else if ((m == param4) & (Q2 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 4");
                        Q2 += QSup5;
                        m = GetMin(param5);
                        if ((m == param5) & (Q2 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }


                    }
                }
                else if ((m == param3) & (Q2 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 3");
                    Q2 += QSup4;
                    m = GetMin(param4, param5);
                    if ((m == param4) & (Q2 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 4");
                        Q2 += QSup5;
                        m = GetMin(param5);
                        if ((m == param5) & (Q2 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }

                    }
                    if ((m == param5) & (Q2 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 5");
                    }
                }
            }



            else if ((m == param3) & (Q3 <= 31))
            {
                Console.WriteLine("We Select The Supplier 3");
                Q3 += QSup1;
                m = GetMin(param1, param2, param4, param5);
                if ((m == param1) & (Q3 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 1");
                    Q3 += QSup2;
                    m = GetMin(param2, param4, param5);
                    if ((m == param2) & (Q3 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 2");
                        Q3 += QSup4;
                        m = GetMin(param4, param5);
                        if ((m == param4) & (Q3 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 4");
                            Q3 += QSup5;
                            m = GetMin(param5);
                            if ((m == param5) & (Q3 <= 31))
                            {
                                Console.WriteLine("We Select The Supplier 5");
                            }

                        }
                        else if ((m == param5) & (Q3 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }
                    }
                    else if ((m == param4) & (Q3 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 4");
                        Q3 += QSup5;
                        m = GetMin(param5);
                        if ((m == param5) & (Q3 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }

                    }
                }
                else if ((m == param2) & (Q3 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 2");
                    Q3 += QSup4;
                    m = GetMin(param4, param5);
                    if ((m == param4) & (Q3 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 4");
                        Q3 += QSup5;
                        m = GetMin(param5);
                        if ((m == param5) & (Q3 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }

                    }
                    else if ((m == param5) & (Q3 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 5");
                    }
                }
            }



            else if ((m == param4) & (Q4 <= 31))
            {
                Console.WriteLine("We Select The Supplier 4");
                Q4 += QSup1;
                m = GetMin(param1, param2, param3, param5);
                if ((m == param1) & (Q4 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 1");
                    Q4 += QSup2;
                    m = GetMin(param2, param3, param5);
                    if ((m == param2) & (Q4 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 2");
                        Q4 += QSup3;
                        m = GetMin(param3, param5);
                        if ((m == param3) & (Q4 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 3");
                            Q4 += QSup5;
                            m = GetMin(param5);
                            if ((m == param5) & (Q4 <= 31))
                            {
                                Console.WriteLine("We Select The Supplier 5");
                            }

                        }
                        if ((m == param5) & (Q4 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }
                    }
                    else if ((m == param3) & (Q4 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 3");
                        Q4 += QSup5;
                        m = GetMin(param5);
                        if ((m == param5) & (Q4 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }
                    }
                }
                else if ((m == param2) & (Q4 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 2");
                    Q4 += QSup3;
                    m = GetMin(param3, param5);
                    if ((m == param3) & (Q4 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 3");
                        Q4 += QSup5;
                        m = GetMin(param5);
                        if ((m == param5) & (Q4 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 5");
                        }

                    }
                    if ((m == param5) & (Q4 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 5");
                    }
                }
            }



            else if ((m == param5) & (Q5 <= 31))
            {
                Console.WriteLine("We Select The Supplier 5");
                Q5 += QSup1;
                m = GetMin(param1, param2, param3, param4);
                if ((m == param1) & (Q5 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 1");
                    Q5 += QSup2;
                    m = GetMin(param2, param3, param4);
                    if ((m == param2) & (Q5 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 2");
                        Q5 += QSup3;
                        m = GetMin(param3, param4);
                        if ((m == param3) & (Q5 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 3");
                            Q5 += QSup4;
                            m = GetMin(param4);
                            if ((m == param4) & (Q5 <= 31))
                            {
                                Console.WriteLine("We Select The Supplier 4");
                            }

                        }
                        if ((m == param4) & (Q5 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 4");
                        }
                    }
                    else if ((m == param3) & (Q5 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 3");
                        Q5 += QSup4;
                        m = GetMin(param4);
                        if ((m == param4) & (Q5 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 4");
                        }

                    }
                }
                else if ((m == param2) & (Q5 <= 31))
                {
                    Console.WriteLine("We Select The Supplier 2");
                    Q5 += QSup3;
                    m = GetMin(param3, param4);
                    if ((m == param3) & (Q5 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 3");
                        Q5 += QSup4;
                        m = GetMin(param4);
                        if ((m == param4) & (Q5 <= 31))
                        {
                            Console.WriteLine("We Select The Supplier 4");
                        }

                    }
                    if ((m == param4) & (Q5 <= 31))
                    {
                        Console.WriteLine("We Select The Supplier 4");
                    }
                }
            }

        }




        public static double GetMin(params double[] DoubleCollection)
        {
            double min = double.MaxValue;
            foreach (double i in DoubleCollection)
            {
                if (i < min)
                {
                    min = i;
                }
            }
            return min;

        }

 وممّا زادنـــي شرفــاً وتيهــاً   **  وكدت بأخمصي أطأ الثريّا

دخولي تحت قولك يا عبادي  **   وأن صيّرت أحمد لي نبيّـاً

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