marangoni

Cruise Games - За проверка

Jul 27th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.  
  5.  
  6.  
  7. namespace ConsoleApp1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string namePlayer = Console.ReadLine();
  14. int countGames = int.Parse(Console.ReadLine());
  15.  
  16. double tempPointVolley = 0;
  17. double tempPointTenis = 0;
  18. double tempPointBadminton = 0;
  19. double sumGameVoley = 0;
  20. double sumGameTenis = 0;
  21. double sumGameBadm = 0;
  22.  
  23. for (int i = 0; i < countGames; i++)
  24. {
  25. string nameGame = Console.ReadLine();
  26. double countPoints = double.Parse(Console.ReadLine());
  27.  
  28. if (nameGame == "volleyball")
  29. {
  30. tempPointVolley = countPoints * 1.07;
  31. sumGameVoley += tempPointVolley;
  32. }
  33. else if (nameGame == "tennis")
  34. {
  35. tempPointTenis = countPoints * 1.05;
  36. sumGameTenis += tempPointTenis;
  37. }
  38. else if (nameGame == "badminton")
  39. {
  40. tempPointBadminton = countPoints * 1.02;
  41. sumGameBadm += tempPointBadminton;
  42. }
  43. }
  44. double sumPoint = Math.Floor(sumGameVoley + sumGameTenis + sumGameBadm);
  45. double srednoaritmeticno = Math.Floor(sumPoint / countGames);
  46. if (srednoaritmeticno >= 75)
  47. {
  48. Console.WriteLine($"Congratulations, {namePlayer}! You won the cruise games with {sumPoint} points.");
  49. }
  50. else
  51. {
  52. Console.WriteLine($"Sorry, {namePlayer}, you lost. Your points are only {sumPoint}.");
  53. }
  54.  
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment