Exemplo n.º 1
0
        public void Ekle(object o)
        {
            if (count == size)
            {
                throw new Exception("Queue is full");
            }

            if (IsEmpty())
            {
                front++;
                Kisiler[front] = o;
                count++;
            }
            else
            {
                int i;
                for (i = count - 1; i >= 0; i--)
                {
                    Kisi Biri   = (Kisi)o;
                    Kisi Kuyruk = (Kisi)Kisiler[i];
                    if (Biri.IslemSuresi > Kuyruk.IslemSuresi)
                    {
                        Kisiler[i + 1] = Kisiler[i];
                    }
                    else
                    {
                        break;
                    }
                }
                Kisiler[i + 1] = o;
                front++;
                count++;
            }
        }
Exemplo n.º 2
0
        public int SureBulArt(int x)
        {
            Kisi K    = (Kisi)Kisiler[x];
            int  sure = K.IslemSuresi;

            return(sure);
        }
Exemplo n.º 3
0
        public int SureBulAz(int x)
        {
            Kisi K = (Kisi)Kisiler[x];

            return(K.IslemSuresi);
        }
Exemplo n.º 4
0
        private void btnHesapla_Click(object sender, EventArgs e)
        {
            Random randomSure = new Random();


            Artan  ArtanK  = new Artan(20);
            Azalan AzalanK = new Azalan(20);
            Fifo   FifoK   = new Fifo(20);


            for (int i = 0; i < 20; i++)
            {
                Random Rnd     = new Random();
                int    sure    = Rnd.Next(60, 600);
                Kisi   Musteri = new Kisi {
                    IslemSuresi = sure
                };
                ArtanK.Ekle(Musteri);
                AzalanK.Ekle(Musteri);
                FifoK.Ekle(Musteri);
            }

            string artanListe  = "";
            string azalanListe = "";
            string fifoListe   = "";

            for (int i = 0; i < 20; i++)
            {
                int art = ArtanK.SureBulArt(i);
                artanListe += (i + 1).ToString() + ".müşteri: " + art.ToString() + Environment.NewLine;
                int az = AzalanK.SureBulAz(i);
                azalanListe += (i + 1).ToString() + ".müşteri: " + az.ToString() + Environment.NewLine;
                int fif = FifoK.SureBulFif(i);
                fifoListe += (i + 1).ToString() + ".müşteri: " + fif.ToString() + Environment.NewLine;
            }

            txtAzalanListe.Text   = azalanListe;
            txtArtanListe.Text    = artanListe;
            txtDaireselListe.Text = fifoListe;

            string farkArtan  = "";
            string farkAzalan = "";

            for (int i = 0; i < 20; i++)
            {
                int art = ArtanK.KuyrukSureBul(i);
                int az  = AzalanK.KuyrukSureBul(i);
                int fif = FifoK.KuyrukSureBul(i);

                farkArtan += (art - fif).ToString() + Environment.NewLine;
                farkArtan += (az - fif).ToString() + Environment.NewLine;
            }
            txtArtanFark.Text  = farkArtan;
            txtAzalanFark.Text = farkAzalan;

            int ar = ArtanK.KuyrukSureBul(19);

            txtArtanToplam.Text = ar.ToString();
            int azl = AzalanK.KuyrukSureBul(19);

            txtAzalanToplam.Text = azl.ToString();
            int ff = FifoK.KuyrukSureBul(19);

            txtFifoToplamSure.Text = ff.ToString();

            txtFifoOrtalama.Text   = (ff / 20).ToString();
            txtArtanOrtalama.Text  = (ar / 20).ToString();
            txtAzalanOrtalama.Text = (azl / 20).ToString();

            int farkArt = ar - ff;
            int farkAz  = azl - ff;

            txtAzalanTopFark.Text     = farkAz.ToString();
            txtArtanTopFark.Text      = farkArt.ToString();
            txtAzalanFarkYuzdesi.Text = (farkArt * 100 / ff).ToString();
            txtArtanFarkYuzdesi.Text  = (farkAz * 100 / ff).ToString();
        }