Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Drafty
- {
- class Program
- {
- interface CallCenter
- {
- public void Response();
- public void Call();
- }
- class Corp1 : CallCenter
- {
- string[] workersName;
- public Corp1(params string[] workersName)
- {
- if (workersName.Length == 0)
- {
- this.workersName = new string[1] { "Юлия" };
- }
- else
- {
- this.workersName = new string[workersName.Length];
- for (int i=0; i<workersName.Length; i++)
- {
- this.workersName[i] = workersName[i];
- }
- }
- }
- public void Call()
- {
- Console.WriteLine("Здравствуйте, где вы живёте?");
- }
- public void Response()
- {
- Random random = new();
- Console.WriteLine($"Здравствуйте, {this.workersName[random.Next(0, this.workersName.Length - 1)]} вас слушает");
- }
- }
- class Corp2 : CallCenter
- {
- public void Call()
- {
- Console.WriteLine("Зачем вы сюда звОните?");
- }
- public void Response()
- {
- Console.WriteLine("Не звоните сюда больше");
- }
- }
- static void Main(string[] args)
- {
- CallCenter someCorp = new Corp2();
- CallCenter anotherCorp = new Corp1("Антон", "Евгений", "Елена");
- someCorp.Call();
- someCorp.Response();
- Console.WriteLine();
- anotherCorp.Call();
- anotherCorp.Response();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment