Advertisement
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 ConsoleApplication23
- {
- public class Banks
- {
- public string bankName { get; set; }
- public string acauntName { get; set; }
- public decimal moneyInTheBank { get; set; }
- }
- class Program
- {
- static void Main(string[] args)
- {
- var input = Console.ReadLine();
- var listOfEx = new List<Banks>();
- while (input !="end")
- {
- var inputLine = input.Split(new[] { ' ', '|'}, StringSplitOptions.RemoveEmptyEntries);
- var bankName = inputLine[0];
- var accName = inputLine[1];
- var money = decimal.Parse(inputLine[2]);
- var temp = new Banks();
- temp.bankName = bankName;
- temp.acauntName = accName;
- temp.moneyInTheBank = money;
- listOfEx.Add(temp);
- input = Console.ReadLine();
- }
- var result = listOfEx
- .OrderByDescending(x => x.moneyInTheBank)
- .ThenBy(x => x.bankName.Length)
- .ToList();
- foreach (var item in result)
- {
- Console.WriteLine($"{item.acauntName} -> {item.moneyInTheBank} ({item.bankName})");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement