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;
- using System.Text.RegularExpressions;
- using System.IO;
- namespace ConsoleApp1
- {
- struct Employe : IComparable<Employe>
- {
- string name;
- string surname;
- string secondName;
- int yearOfEmployment;
- string position;
- int salary;
- int workExperience;
- public Employe(string surname, string name, string secondName, int yearOfEmployment,
- string position, int salary, int workExperience)
- {
- this.surname = surname;
- this.name = name;
- this.secondName = secondName;
- this.yearOfEmployment = yearOfEmployment;
- this.position = position;
- this.salary = salary;
- this.workExperience = workExperience;
- }
- public void Show()
- {
- Console.WriteLine(string.Join(" ", surname, name, secondName, yearOfEmployment.ToString(),
- position, salary.ToString(), workExperience.ToString()));
- }
- public string Get()
- {
- return string.Join(" ", "Full name :",surname, name, secondName,
- "\nyearOfEmployment :", yearOfEmployment.ToString(), "\nposition :",
- position, "\nsalary :", salary.ToString(),"\nexperience :", workExperience.ToString(),
- "\n=================================");
- }
- public bool IsSuit(int value)
- {
- if (salary < value)
- return true;
- else
- return false;
- }
- public int CompareTo(Employe obj)// нужно для использования команды array.Sort();
- {
- if (this.workExperience == obj.workExperience)
- return 0;
- if (this.workExperience < obj.workExperience)
- return 1;
- else
- return -1;
- }
- }
- class Program
- {
- static public Employe[] Input() //ввод массива точек
- {
- using (StreamReader fileIn = new StreamReader(@"C:/Users/karpenkoos/desktop/input.txt"))
- {
- int n = int.Parse(fileIn.ReadLine());
- Employe[] ar = new Employe[n];
- for (int i = 0; i < n; i++)
- {
- string[] text = fileIn.ReadLine().Split(' ');
- ar[i] = new Employe(text[0], text[1], text[2], int.Parse(text[3]), text[4],
- int.Parse(text[5]), int.Parse(text[6]));
- }
- return ar;
- }
- }
- static void Print(Employe[] array)//вывод массива точек
- {
- foreach (Employe item in array)
- {
- item.Show();
- }
- }
- static void Main()
- {
- Employe[] array = Input();
- Array.Sort(array);
- int salaryLevel = 2000;
- using (StreamWriter output = new StreamWriter(@"C:/Users/karpenkoos/desktop/output.txt"))
- {
- for (int i = 0; i < array.Length; ++i)
- if (array[i].IsSuit(salaryLevel))
- {
- //array[i].Show();
- output.WriteLine(array[i].Get());
- }
- }
- /*
- 21
- Ololoev Ololosha Ololoshovich 2015 Middle 2000 5
- Lavera Eldred Boreng 2015 Low 1235 4
- Neoma Boggs Aung 2015 Low 1424 4
- Shirlene Bode Feros 2015 Developer 2315 5
- Mario Beane Quri 2015 Low 1241 4
- Long Heston Unofs 2015 Developer 5235 6
- Cheryll Balderas Roots 2015 ClearWorker 1245 4
- Shaquana Burkett Gemen 2015 Low 1232 3
- Nichole Frances Rasif 2015 GenDirector 6457 6
- Euna Draper Daun 2015 Developer 2421 5
- Carita Henriksen Colers 2015 Low 1352 4
- Treena Nicholes Samer 2015 Director 7533 7
- Julianna Baranowski Poons 2015 Middle 1350 4
- Nu Cordes Fu 2015 Low 1222 3
- Tommie Mangels Lon 2015 Low 1110 3
- June Kinnaman Decit 2015 Cea 15325 15
- Annetta Trail Eurs 2015 Developer 3333 6
- Nedra Class Lee 2015 Low 666 2
- Kerrie Lepley Code 2015 Securety 99 2
- Felisha Moorhead Rouch 2015 Meneger 5000 5
- Olivia Tusa Packege 2015 Middle 1546 3
- */
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement