Advertisement
RadoG

The football statistician

Jan 23rd, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.36 KB | None | 0 0
  1. using System;
  2.  
  3. namespace The_football_statistician
  4. {
  5.     class TheFootballStatistician
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var payment = double.Parse(Console.ReadLine());
  10.             var playCount = 0;
  11.  
  12.             var pointsArsenal = 0;
  13.             var pointsChelsea = 0;
  14.             var pointsMCity = 0;
  15.             var pointsMUnited = 0;
  16.             var pointsLiverpool = 0;
  17.             var pointsEverton = 0;
  18.             var pointsSouthampton = 0;
  19.             var pointsTottenham = 0;
  20.  
  21.             while (true)
  22.             {
  23.                 var line = Console.ReadLine();
  24.  
  25.                 if (line == "End of the league.")
  26.                 {
  27.                     break;
  28.                 }
  29.  
  30.                 string[] parameters = line.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
  31.                 var team1 = parameters[0];
  32.                 var team2 = parameters[2];
  33.                 var result = parameters[1];
  34.                 var team1Points = 0;
  35.                 var team2Points = 0;
  36.  
  37.                 if (result == "1")
  38.                 {
  39.                     team1Points = 3;
  40.                     team2Points = 0;
  41.                 }
  42.                 else if (result == "X")
  43.                 {
  44.                     team1Points = 1;
  45.                     team2Points = 1;
  46.                 }
  47.                 else if (result == "2")
  48.                 {
  49.                     team1Points = 0;
  50.                     team2Points = 3;
  51.                 }
  52.  
  53.                 switch (team1)
  54.                 {
  55.                     case "Arsenal":
  56.                         pointsArsenal += team1Points;
  57.                         break;
  58.                     case "Chelsea":
  59.                         pointsChelsea += team1Points;
  60.                         break;
  61.                     case "ManchesterCity":
  62.                         pointsMCity += team1Points;
  63.                         break;
  64.                     case "ManchesterUnited":
  65.                         pointsMUnited += team1Points;
  66.                         break;
  67.                     case "Liverpool":
  68.                         pointsLiverpool += team1Points;
  69.                         break;
  70.                     case "Everton":
  71.                         pointsEverton += team1Points;
  72.                         break;
  73.                     case "Southampton":
  74.                         pointsSouthampton += team1Points;
  75.                         break;
  76.                     case "Tottenham":
  77.                         pointsTottenham += team1Points;
  78.                         break;
  79.                 }
  80.  
  81.                 switch (team2)
  82.                 {
  83.                     case "Arsenal":
  84.                         pointsArsenal += team2Points;
  85.                         break;
  86.                     case "Chelsea":
  87.                         pointsChelsea += team2Points;
  88.                         break;
  89.                     case "ManchesterCity":
  90.                         pointsMCity += team2Points;
  91.                         break;
  92.                     case "ManchesterUnited":
  93.                         pointsMUnited += team2Points;
  94.                         break;
  95.                     case "Liverpool":
  96.                         pointsLiverpool += team2Points;
  97.                         break;
  98.                     case "Everton":
  99.                         pointsEverton += team2Points;
  100.                         break;
  101.                     case "Southampton":
  102.                         pointsSouthampton += team2Points;
  103.                         break;
  104.                     case "Tottenham":
  105.                         pointsTottenham += team2Points;
  106.                         break;
  107.                 }
  108.                 playCount++;
  109.             }
  110.  
  111.             Console.WriteLine("{0:f2}lv.", playCount * payment * 1.94);
  112.             Console.WriteLine("Arsenal - {0} points.", pointsArsenal);
  113.             Console.WriteLine("Chelsea - {0} points.", pointsChelsea);
  114.             Console.WriteLine("Everton - {0} points.", pointsEverton);
  115.             Console.WriteLine("Liverpool - {0} points.", pointsLiverpool);
  116.             Console.WriteLine("Manchester City - {0} points.", pointsMCity);
  117.             Console.WriteLine("Manchester United - {0} points.", pointsMUnited);
  118.             Console.WriteLine("Southampton - {0} points.", pointsSouthampton);
  119.             Console.WriteLine("Tottenham - {0} points.", pointsTottenham);
  120.         }
  121.     }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement