Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Globalization;
- using System.Collections.Generic;
- namespace teest
- {
- class Program
- {
- static void Main(string[] args)
- {
- List< Books> library = new List<Books>();
- SortedDictionary<string, DateTime> requestedInfo = new SortedDictionary<string, DateTime>();
- int caunt =int.Parse(Console.ReadLine()); // caunt of the books
- for (int i = 0; i < caunt; i++)
- {
- string[] token = Console.ReadLine().Split(' ').ToArray();
- string author = token[2];
- Books book = new Books(
- token[0], // title
- token[1], // author
- token[2], // publisher
- DateTime.ParseExact(token[3], "dd.MM.yyyy", CultureInfo.InvariantCulture), // reliseDate
- token[4], // isbn
- double.Parse(token[5])); // price
- library.Add(book);
- }
- string tokenData = Console.ReadLine();
- DateTime minimumData = DateTime.ParseExact(tokenData,"dd.MM.yyyy", CultureInfo.InvariantCulture);
- foreach (var author in library)
- {
- requestedInfo.Add(author.title, author.reliseDate);
- }
- foreach (var token in requestedInfo.OrderByDescending(x => x.Key).OrderByDescending(y => y.Value))
- {
- if (minimumData >= token.Value)
- {
- Console.WriteLine($" {token.Key} -> {token.Value} ");
- }
- }
- }
- }
- public class Books
- {
- public string title { get; set; }
- public string author { get; set; }
- public string publisher { get; set; }
- public DateTime reliseDate { get; set; }
- public string isbn { get; set; }
- public double price { get; set; }
- public Books(string title, string author, string publisher, DateTime MyProperty, string isbn, double price)
- {
- this.title = title;
- this.author = author;
- this.publisher = publisher;
- this.reliseDate = reliseDate;
- this.isbn = isbn;
- this.price = price;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement