Guest User

Untitled

a guest
Jul 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. /*
  2. *
  3. *
  4. *
  5. *
  6. *
  7. *
  8. *
  9. *
  10. */
  11.  
  12. namespace PracticeProgram
  13. {
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Linq;
  17. using System.Text;
  18. using PracticeProgram;
  19.  
  20. public class StockPrice
  21. {
  22. /// <summary>
  23. ///
  24. /// </summary>
  25. /// <param name="args"></param>
  26. static void Main(string[] args)
  27. {
  28. try
  29. {
  30. PortfolioStock.putStockFile(@"C:/Users/vinothkanth/Documents/Visual Studio 2013/Projects/PracticeProgram-I/test.txt");
  31. double[] stockResult = PortfolioStock.fetchSumOfSingleLine();
  32. string[] singleLine = PortfolioStock.fetchSingleLine();
  33. Dictionary<string, double> dict = new Dictionary<string, double>();
  34. for (int stockCount = 0; stockCount < stockResult.Length; stockCount++)
  35. {
  36. dict.Add(singleLine[stockCount], stockResult[stockCount]);
  37. }
  38. var items = from pair in dict orderby pair.Value descending select pair;
  39. foreach (KeyValuePair<string, double> pair in items)
  40. {
  41. Console.WriteLine("Stock Rate ( {0} )\t => For [ {1} ]", pair.Value, pair.Key);
  42. }
  43.  
  44. Console.ReadKey();
  45.  
  46. }
  47. catch (Exception fileNotFount)
  48. {
  49. Console.WriteLine(fileNotFount);
  50. }
  51. }
  52. }
  53. }
Add Comment
Please, Sign In to add comment