Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication4
- {
- class Program
- {
- static void Main(string[] args)
- {
- Teams arsenal = new Teams
- {
- name = "Arsenal",
- points = 0
- };
- Teams chelsea = new Teams
- {
- name = "Chelsea",
- points = 0
- };
- Teams everton = new Teams
- {
- name = "Everton",
- points = 0
- };
- Teams liverpool = new Teams
- {
- name = "Liverpool",
- points = 0
- };
- Teams manchesterCity = new Teams
- {
- name = "ManchesterCity",
- points = 0
- };
- Teams manchesterUnited = new Teams
- {
- name = "ManchesterUnited" ,
- points = 0
- };
- Teams southampton = new Teams
- {
- name = "Southampton",
- points = 0
- };
- Teams tottenham = new Teams
- {
- name = "Tottenham",
- points = 0
- };
- Dictionary<string, Teams> team = new Dictionary<string, Teams>();
- team.Add(arsenal.name, arsenal);
- team.Add(chelsea.name, chelsea);
- team.Add(everton.name, everton);
- team.Add(liverpool.name, liverpool);
- team.Add(manchesterCity.name, manchesterCity);
- team.Add(manchesterUnited.name, manchesterUnited);
- team.Add(southampton.name, southampton);
- team.Add(tottenham.name, tottenham);
- string input;
- float payment = float.Parse(Console.ReadLine());
- int counter = 0;
- do
- {
- input = Console.ReadLine();
- string[] array = input.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- if (array[1].ToLower() == "x")
- {
- Teams notWinnerHome;
- if (team.TryGetValue(array[0], out notWinnerHome))
- {
- notWinnerHome.points += 1;
- }
- if (team.TryGetValue(array[2], out notWinnerHome))
- {
- notWinnerHome.points += 1;
- }
- }
- if (array[1] == "1")
- {
- Teams winnerHome;
- if (team.TryGetValue(array[0], out winnerHome))
- {
- winnerHome.points += 3;
- }
- }
- if (array[1] == "2")
- {
- Teams winnerAway;
- if (team.TryGetValue(array[2], out winnerAway))
- {
- winnerAway.points += 3;
- }
- }
- counter++;
- } while (input != "End of the league.");
- counter--;
- float finalPayment = (float)((payment * counter) * 1.94);
- Console.Write("{0:F2}", finalPayment);
- Console.Write("lv.");
- Console.WriteLine();
- foreach (KeyValuePair<string, Teams> squad in team)
- {
- Teams outputTeam = squad.Value;
- Console.WriteLine("{0} - {1} points.", outputTeam.name, outputTeam.points);
- }
- }
- public class Teams
- {
- public string name { get; set; }
- public int points { get; set; }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment