Advertisement
aneliabogeva

Untitled

Apr 6th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 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 Sinema_Tickets
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string name = Console.ReadLine();
  14. double capacity = 0;
  15. double totalcounter = 0;
  16. double totalStudent = 0;
  17. double totalStandard = 0;
  18. double totalKid = 0;
  19. int totalTicket = 0;
  20.  
  21. while (name != "Finish")
  22. {
  23. string numberFreePlaces = Console.ReadLine();
  24. string type = Console.ReadLine();
  25. int counterStudent = 0;
  26. int counterStandard = 0;
  27. int counterKids = 0;
  28.  
  29. switch (type)
  30. {
  31. case "student":
  32. counterStudent += 1;
  33. break;
  34. case "standard":
  35. counterStandard += 1;
  36. break;
  37. case "kid":
  38. counterKids += 1;
  39. break;
  40. default:
  41. break;
  42.  
  43. }
  44. totalcounter = counterStudent + counterStandard + counterKids;
  45.  
  46. while (totalcounter < int.Parse(numberFreePlaces))
  47. {
  48. type = Console.ReadLine();
  49. if (type == "End")
  50. {
  51. break;
  52. }
  53. else
  54. {
  55. switch (type)
  56. {
  57. case "student":
  58. counterStudent += 1;
  59. break;
  60. case "standard":
  61. counterStandard += 1;
  62. break;
  63. case "kid":
  64. counterKids += 1;
  65. break;
  66. default:
  67. break;
  68.  
  69. }
  70. totalcounter += 1;
  71. }
  72. }
  73. capacity = (totalcounter * 100) / int.Parse(numberFreePlaces);
  74. Console.WriteLine($"{name} - {capacity:f2}% full.");
  75. totalKid += counterKids;
  76. totalStandard += counterStandard;
  77. totalStudent += counterStudent;
  78. totalTicket += (int)totalcounter;
  79.  
  80. name = Console.ReadLine();
  81.  
  82. }
  83. Console.WriteLine($"Total tickets: {totalTicket}");
  84. Console.WriteLine($"{((totalStudent*100)/ totalTicket):f2}% student tickets.");
  85. Console.WriteLine($"{((totalStandard * 100) / totalTicket):f2}% standard tickets.");
  86. Console.WriteLine($"{((totalKid * 100) / totalTicket):f2}% kids tickets.");
  87. }
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement