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 ConsoleApp15
- {
- class Program
- {
- static void Main(string[] args)
- {
- Person[] person = new Person[5];
- Person person1 = new Person();
- Person person2 = new Person("Ivan", "Petrov", 22, 1600);
- Person person3 = new Person("Icko", "Georgiev", 32, 1300);
- Person person4 = new Person("Nadq", "Misheva", 23, 1700);
- Person person5 = new Person("Plamen", "Petkov", 27, 1300);
- person[0] = person1;
- person[1] = person2;
- person[2] = person3;
- person[3] = person4;
- person[4] = person5;
- CheckSalary(1100, person);
- }
- static void CheckSalary(int salary, Person[] persons)
- {
- foreach (var i in persons)
- {
- if (i.salary > 1200)
- {
- Console.WriteLine(i.firstname);
- }
- }
- }
- }
- class Person {
- public string firstname;
- string lastname;
- int age;
- public int salary;
- public Person (string firstname, string lastname, int age, int salary)
- {
- this.firstname = firstname;
- this.lastname = lastname;
- this.age = age;
- this.salary = salary;
- }
- public Person()
- {
- this.firstname = "Peter";
- this.lastname = "Petrov";
- this.age = 25;
- this.salary = 1500;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement