Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Kolos
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. while (true)
  14. {
  15.  
  16. try
  17. {
  18. Player player = new Player();
  19.  
  20. Pop pop = new Pop("1", "1", "1");
  21. player.DodajPiosenke(pop);
  22. Alt alt = new Alt("2", "2", "2");
  23. player.DodajPiosenke(alt);
  24. Rock rock = new Rock("ss", "ss", "ss");
  25. player.DodajPiosenke(rock);
  26. Jazz jazz = new Jazz("ok", "ok", "ok");
  27. player.DodajPiosenke(jazz);
  28. player.WyswietlPiosenki();
  29.  
  30. string[] menu = { "Dodawanie utworu", "Usuwanie utworu", "Wyświetl odtwarzacz"};
  31. for (int i = 0; i < menu.Length; i++)
  32. {
  33. Console.WriteLine((i + 1) + "." + menu[i]);
  34. }
  35.  
  36.  
  37. string caseSwitch1 = (Console.ReadLine());
  38. switch (caseSwitch1)
  39. {
  40. case "Dodaj":
  41. Console.WriteLine("Podaj nazwe utworu:");
  42. string utwor = (Console.ReadLine());
  43. Console.WriteLine("Podaj nazwe wykonawcy:");
  44. string wykonawca = (Console.ReadLine());
  45. Console.WriteLine();
  46. Console.WriteLine("Wybierz gatunek muzyki danego utworu:");
  47. string[] gatunek = { "Alternatywa", "Jazz", "Pop", "Rock", "Wyjście" };
  48. for (int i = 0; i < gatunek.Length; i++)
  49. {
  50. Console.WriteLine((i + 1) + "." + gatunek[i]);
  51. }
  52.  
  53. int caseSwitch = int.Parse(Console.ReadLine());
  54. switch (caseSwitch)
  55. {
  56. case 1:
  57. Alt alt1 = new Alt(utwor, wykonawca, gatunek[0]);
  58. player.DodajPiosenke(alt1);
  59.  
  60. break;
  61. case 2:
  62. Jazz jazz1 = new Jazz(utwor, wykonawca, gatunek[1]);
  63. player.DodajPiosenke(jazz1);
  64. break;
  65. case 3:
  66. Pop pop1 = new Pop(utwor, wykonawca, gatunek[2]);
  67. player.DodajPiosenke(pop1);
  68. pop1.Play();
  69. break;
  70. case 4:
  71. Rock rock1 = new Rock(utwor, wykonawca, gatunek[3]);
  72. player.DodajPiosenke(rock1);
  73. rock1.Play();
  74. break;
  75. case 5:
  76. Environment.Exit(1);
  77. break;
  78.  
  79. default:
  80. Console.WriteLine();
  81. break;
  82. }
  83. case "Usuń":
  84. Console.WriteLine("usuwanie");
  85. break;
  86.  
  87. case "Wyświetl":
  88. player.WyswietlPiosenki();
  89. break;
  90.  
  91.  
  92.  
  93.  
  94. }
  95.  
  96.  
  97.  
  98.  
  99. }
  100.  
  101.  
  102.  
  103.  
  104. catch (FormatException)
  105. {
  106. Console.Clear();
  107. Console.WriteLine("Została wprowadzona błędna wartość");
  108. }
  109.  
  110. catch (ArgumentOutOfRangeException)
  111. { Console.WriteLine("Została wprowadzona za duża wartość "); }
  112. }
  113. }
  114. }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement