Advertisement
Infiniti_Inter

14-II (S)

Dec 9th, 2019
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.32 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.Text.RegularExpressions;
  7. using System.IO;
  8.  
  9.  
  10. namespace ConsoleApp1
  11. {
  12.     struct Employe : IComparable<Employe>
  13.     {
  14.  
  15.         string name;
  16.         string surname;
  17.         string secondName;
  18.         int yearOfEmployment;
  19.         string position;
  20.         int salary;
  21.         int workExperience;
  22.  
  23.         public Employe(string surname, string name, string secondName, int yearOfEmployment,
  24.             string position, int salary, int workExperience)
  25.         {
  26.             this.surname = surname;
  27.             this.name = name;
  28.             this.secondName = secondName;
  29.             this.yearOfEmployment = yearOfEmployment;
  30.             this.position = position;
  31.             this.salary = salary;
  32.             this.workExperience = workExperience;
  33.         }
  34.         public void Show()
  35.         {
  36.             Console.WriteLine(string.Join(" ", surname, name, secondName, yearOfEmployment.ToString(),
  37.                 position, salary.ToString(), workExperience.ToString()));
  38.         }
  39.         public string Get()
  40.         {
  41.             return string.Join(" ", "Full name :",surname, name, secondName,
  42.                 "\nyearOfEmployment :", yearOfEmployment.ToString(), "\nposition :",
  43.                 position, "\nsalary :", salary.ToString(),"\nexperience :", workExperience.ToString(),
  44.                 "\n=================================");
  45.         }
  46.         public bool IsSuit(int value)
  47.         {
  48.             if (salary < value)
  49.                 return true;
  50.             else
  51.                 return false;
  52.         }
  53.  
  54.         public int CompareTo(Employe obj)// нужно для использования команды array.Sort();
  55.         {
  56.             if (this.workExperience == obj.workExperience)
  57.                 return 0;
  58.             if (this.workExperience < obj.workExperience)
  59.                 return 1;
  60.             else
  61.                 return -1;
  62.         }
  63.  
  64.  
  65.     }
  66.     class Program
  67.     {
  68.         static public Employe[] Input() //ввод массива точек
  69.         {
  70.             using (StreamReader fileIn = new StreamReader(@"C:/Users/karpenkoos/desktop/input.txt"))
  71.             {
  72.                 int n = int.Parse(fileIn.ReadLine());
  73.                 Employe[] ar = new Employe[n];
  74.                 for (int i = 0; i < n; i++)
  75.                 {
  76.                     string[] text = fileIn.ReadLine().Split(' ');
  77.                     ar[i] = new Employe(text[0], text[1], text[2], int.Parse(text[3]), text[4],
  78.                         int.Parse(text[5]), int.Parse(text[6]));
  79.                 }
  80.                 return ar;
  81.             }
  82.         }
  83.         static void Print(Employe[] array)//вывод массива точек
  84.         {
  85.             foreach (Employe item in array)
  86.             {
  87.                 item.Show();
  88.             }
  89.         }
  90.         static void Main()
  91.         {
  92.             Employe[] array = Input();
  93.             Array.Sort(array);
  94.             int salaryLevel = 2000;
  95.             using (StreamWriter output = new StreamWriter(@"C:/Users/karpenkoos/desktop/output.txt"))
  96.             {
  97.                 for (int i = 0; i < array.Length; ++i)
  98.                     if (array[i].IsSuit(salaryLevel))
  99.                     {
  100.                         //array[i].Show();
  101.                         output.WriteLine(array[i].Get());
  102.                     }
  103.  
  104.             }
  105.  
  106. /*
  107. 21
  108. Ololoev Ololosha Ololoshovich 2015 Middle 2000 5
  109. Lavera Eldred Boreng 2015 Low 1235 4
  110. Neoma Boggs Aung 2015 Low 1424 4
  111. Shirlene Bode Feros 2015 Developer 2315 5
  112. Mario Beane Quri 2015 Low 1241 4
  113. Long Heston Unofs 2015 Developer 5235 6
  114. Cheryll Balderas Roots 2015 ClearWorker 1245 4
  115. Shaquana Burkett Gemen 2015 Low 1232 3
  116. Nichole Frances Rasif 2015 GenDirector 6457 6
  117. Euna Draper Daun 2015 Developer 2421 5
  118. Carita Henriksen Colers 2015 Low 1352 4
  119. Treena Nicholes Samer 2015 Director 7533 7
  120. Julianna Baranowski Poons 2015 Middle 1350 4
  121. Nu Cordes Fu 2015 Low 1222 3
  122. Tommie Mangels Lon 2015 Low 1110 3
  123. June Kinnaman Decit 2015 Cea 15325 15
  124. Annetta Trail Eurs 2015 Developer 3333 6
  125. Nedra Class Lee 2015 Low 666 2
  126. Kerrie Lepley Code 2015 Securety 99 2
  127. Felisha Moorhead Rouch 2015 Meneger 5000 5
  128. Olivia Tusa Packege 2015 Middle 1546 3
  129. */          
  130.  
  131.         }
  132.     }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement