y s

y s

  • NA
  • 62
  • 26.1k

need help for value in sortedList change to percentage

Apr 10 2011 10:42 AM
i meet 2 problems now.
the 1st problem is ,i have a sortedList, i need to change the value into percentage.
my 2nd problem is after change to percentage.
when i key in minimum support, if the value which is not fulfill the minimum support, then will ignore it.

* total trasaction is 20=contentBox
my sortedLIst:
1:  11
2:  14
4:  5
3:  13
6:  3
5:  6
now i can change the value to percentage.the code are shown below.
but the problem is , it just can show value only, i want the output is like this:
1:  55
2:  70
4:  25
3:  65
6:  15
5:  30

 double v2;
  richTextBox13.Clear();
  foreach (String sorting2 in sortList1.Keys)
  {
  if (!(sortList11.ContainsKey(sorting2)))
  {
  sortList1.TryGetValue(sorting2, out v2);

  sortList11.Add(sorting2, v2);
  double Count1 = (double)sortList11[sorting2];
  sortList11[sorting2] = (v2  / ContentBox.Lines.Length)*100;

  }
  richTextBox13.AppendText(sortList11[sorting2].ToString() + "\n");
  }
       double[] store = new double[richTextBox13.Lines.Length];
        int al = 0;
            foreach (double abv in sortList11.Values)
            {
                store[al] = abv;
                al++;
            }
            string min_supp = textBox9.Text;
            double min = Double.Parse(min_supp);
            textBox4.Text = textBox9.Text;
            string output = "";

            for (int prune = 0; prune < richTextBox13.Lines.Length; prune++)
            {
                if (store[prune] >= min)
                {
                 output +=  store[prune] + "\n";
                }
                richTextBox14.Clear();
                   richTextBox14.AppendText(output );             
            }
explaination above are my 1st problem.

for my 2nd problem,
if i get my expected output,
then if i key in minimum support like 40%, if nto fulfill 40, it will ignore.
My expected output is :

1:  55
2:  70
3:  65

hope can help me..

Answers (10)