Guest User

Untitled

a guest
Nov 2nd, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.73 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. using System.Globalization;
  7. using System.Threading;
  8.  
  9. namespace ConsoleApplication32
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
  16.  
  17.             decimal payment = decimal.Parse(Console.ReadLine(), System.Globalization.CultureInfo.InvariantCulture);
  18.             //string command = "";
  19.             //Console.WriteLine("On the next lines you are given several input lines");
  20.             string inputline = "";
  21.             string result = "";
  22.  
  23.             int arsenalPoints = 0;
  24.             int chelseaPoints = 0;
  25.             int manchesterCityPoints = 0;
  26.             int manchesterUnitedPoints = 0;
  27.             int liverpoolPoints = 0;
  28.             int evertonPoints = 0;
  29.             int southamptonPoints = 0;
  30.             int tottenhamPoints = 0;
  31.  
  32.             int matchesCounter = 0;
  33.  
  34.             while (inputline != "End of the league.")
  35.             {
  36.                 matchesCounter++;
  37.                 inputline = Console.ReadLine();
  38.                 char[] delimiter = { ' ' };
  39.                 string[] matchInfo = inputline.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
  40.                 string homeTeam = matchInfo[0];
  41.                 result = matchInfo[1];
  42.                 string guestTeam = matchInfo[2];
  43.  
  44.  
  45.                 if (homeTeam == "Arsenal" && result == "1")
  46.                 {
  47.  
  48.                     arsenalPoints = arsenalPoints + 3;
  49.                 }
  50.                 else if (homeTeam == "Arsenal" && result == "X")
  51.                 {
  52.  
  53.                     arsenalPoints = arsenalPoints + 1;
  54.                 }
  55.  
  56.                 if (homeTeam == "Chelsea" && result == "1")
  57.                 {
  58.  
  59.                     chelseaPoints = chelseaPoints + 3;
  60.                 }
  61.                 else if (homeTeam == "Chelsea" && result == "X")
  62.                 {
  63.  
  64.                     chelseaPoints = chelseaPoints + 1;
  65.                 }
  66.  
  67.                 if (homeTeam == "ManchesterCity" && result == "1")
  68.                 {
  69.  
  70.                     manchesterCityPoints = manchesterCityPoints + 3;
  71.                 }
  72.                 else if (homeTeam == "ManchesterCity" && result == "X")
  73.                 {
  74.  
  75.                     manchesterCityPoints = manchesterCityPoints + 1;
  76.                 }
  77.  
  78.                 if (homeTeam == "ManchesterUnited" && result == "1")
  79.                 {
  80.  
  81.                     manchesterUnitedPoints = manchesterUnitedPoints + 3;
  82.                 }
  83.                 else if (homeTeam == "ManchesterUnited" && result == "X")
  84.                 {
  85.                    
  86.                     manchesterUnitedPoints = manchesterUnitedPoints + 1;
  87.                 }
  88.  
  89.                 if (homeTeam == "Liverpool" && result == "1")
  90.                 {
  91.  
  92.                     liverpoolPoints = liverpoolPoints + 3;
  93.                 }
  94.                 else if (homeTeam == "Liverpool" && result == "X")
  95.                 {
  96.  
  97.                     liverpoolPoints = liverpoolPoints + 1;
  98.                 }
  99.  
  100.                 if (homeTeam == "Everton" && result == "1")
  101.                 {
  102.  
  103.                     evertonPoints = evertonPoints + 3;
  104.                 }
  105.                 else if (homeTeam == "Everton" && result == "X")
  106.                 {
  107.                     evertonPoints = evertonPoints + 1;
  108.                 }
  109.  
  110.                 if (homeTeam == "Southampton" && result == "1")
  111.                 {
  112.  
  113.                     southamptonPoints = southamptonPoints + 3;
  114.                 }
  115.                 else if (homeTeam == "Southampton" && result == "X")
  116.                 {
  117.  
  118.                     southamptonPoints = southamptonPoints + 1;
  119.                 }
  120.  
  121.                 if (homeTeam == "Tottenham" && result == "1")
  122.                 {
  123.  
  124.                     tottenhamPoints = tottenhamPoints + 3;
  125.                 }
  126.                 else if (homeTeam == "Tottenham" && result == "X")
  127.                 {
  128.  
  129.                     tottenhamPoints = tottenhamPoints + 1;
  130.                 }
  131.  
  132.  
  133.                 if (guestTeam == "Arsenal" && result == "2")
  134.                 {
  135.                     arsenalPoints = arsenalPoints + 3;
  136.                 }
  137.                 else if (guestTeam == "Arsenal" && result == "X")
  138.                 {
  139.  
  140.                     arsenalPoints = arsenalPoints + 1;
  141.                 }
  142.  
  143.                 if (guestTeam == "Chelsea" && result == "2")
  144.                 {
  145.  
  146.                     chelseaPoints = chelseaPoints + 3;
  147.                 }
  148.                 else if (guestTeam == "Chelsea" && result == "X")
  149.                 {
  150.  
  151.                     chelseaPoints = chelseaPoints + 1;
  152.                 }
  153.  
  154.                 if (guestTeam == "ManchesterCity" && result == "2")
  155.                 {
  156.  
  157.                     manchesterCityPoints = manchesterCityPoints + 3;
  158.                 }
  159.                 else if (guestTeam == "ManchesterCity" && result == "X")
  160.                 {
  161.  
  162.                     manchesterCityPoints = manchesterCityPoints + 1;
  163.                 }
  164.  
  165.                 if (guestTeam == "ManchesterUnited" && result == "2")
  166.                 {
  167.  
  168.                     manchesterUnitedPoints = manchesterUnitedPoints + 3;
  169.                 }
  170.                 else if (guestTeam == "ManchesterUnited" && result == "X")
  171.                 {
  172.  
  173.                     manchesterUnitedPoints = manchesterUnitedPoints + 1;
  174.                 }
  175.  
  176.                 if (guestTeam == "Liverpool" && result == "2")
  177.                 {
  178.  
  179.                     liverpoolPoints = liverpoolPoints + 3;
  180.                 }
  181.                 else if (guestTeam == "Liverpool" && result == "X")
  182.                 {
  183.  
  184.                     liverpoolPoints = liverpoolPoints + 1;
  185.                 }
  186.  
  187.  
  188.                 if (guestTeam == "Everton" && result == "2")
  189.                 {
  190.  
  191.                     evertonPoints = evertonPoints + 3;
  192.                 }
  193.                 else if (guestTeam == "Everton" && result == "X")
  194.                 {
  195.  
  196.                     evertonPoints = evertonPoints + 1;
  197.                 }
  198.  
  199.                 if (guestTeam == "Southampton" && result == "2")
  200.                 {
  201.  
  202.                     southamptonPoints = southamptonPoints + 3;
  203.                 }
  204.                 else if (guestTeam == "Southampton" && result == "X")
  205.                 {
  206.  
  207.                     southamptonPoints = southamptonPoints + 1;
  208.                 }
  209.  
  210.                 if (guestTeam == "Tottenham" && result == "2")
  211.                 {
  212.  
  213.                     tottenhamPoints = tottenhamPoints + 3;
  214.                 }
  215.                 else if (guestTeam == "Tottenham" && result == "X")
  216.                 {
  217.  
  218.                     tottenhamPoints = tottenhamPoints + 1;
  219.                 }
  220.             }
  221.  
  222.             //  Console.ForegroundColor = ConsoleColor.Green;
  223.  
  224.             decimal priceForAllMatchesInLeva = ((matchesCounter - 1) * payment) * 1.94m;
  225.             //  Console.WriteLine("Number of matches: " + (matchesCounter-1));
  226.  
  227.             Console.WriteLine("{0:F2}lv.", priceForAllMatchesInLeva);
  228.             Console.WriteLine("Arsenal - {0} points.", arsenalPoints);
  229.             Console.WriteLine("Chelsea - {0} points.", chelseaPoints);
  230.             Console.WriteLine("Everton - {0} points.", evertonPoints);
  231.             Console.WriteLine("Liverpool - {0} points.", liverpoolPoints);
  232.             Console.WriteLine("Manchester City - {0} points.", manchesterCityPoints);
  233.             Console.WriteLine("Manchester United - {0} points.", manchesterUnitedPoints);
  234.             Console.WriteLine("Southampton - {0} points.", southamptonPoints);
  235.             Console.WriteLine("Tottenham - {0} points.", tottenhamPoints);
  236.         }
  237.  
  238.     }
  239. }
Advertisement
Add Comment
Please, Sign In to add comment