Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Text;
- using System.Threading.Tasks;
- using System.Net;
- using System.Threading;
- namespace IMJunior
- {
- class Program
- {
- static void Main()
- {
- while (true)
- {
- string command = Console.ReadLine();
- Departament[] deppartaments = new Departament[10];
- UsersDatabase database = new UsersDatabase();
- Formater formater = new Formater(15);
- UsersListDrawer drawer = new UsersListDrawer(database, formater);
- DepartamentDrawer departamentDrawer = new DepartamentDrawer(null, formater);
- if(command == "UserList")
- {
- drawer.Draw();
- }
- if(command == "DepartamentList")
- {
- departamentDrawer.Draw();
- }
- }
- }
- }
- class UsersDatabase
- {
- private User[] users;
- public void Add(User user)
- {
- }
- public void Remove(User user)
- {
- }
- public User[] GetAll()
- {
- throw new NotImplementedException();
- }
- }
- class UsersListDrawer
- {
- private readonly UsersDatabase _database;
- private readonly Template _template;
- public UsersListDrawer(UsersDatabase database, Formater formater)
- {
- _database = database;
- _template = new Template(formater);
- }
- public void Draw()
- {
- foreach (var item in _database.GetAll())
- {
- _template.Draw(item.Name, item.Salary);
- }
- }
- }
- class DepartamentDrawer
- {
- private readonly Departament[] _database;
- private readonly Template _template;
- public DepartamentDrawer(Departament[] database, Formater formater)
- {
- _database = database;
- _template = new Template(formater);
- }
- public void Draw()
- {
- foreach (var item in _database)
- {
- _template.Draw(item.Name, item.WorkerCount);
- }
- }
- }
- class Template
- {
- private readonly Formater _formater;
- public Template(Formater formater)
- {
- this._formater = formater;
- }
- public void Draw(string data, int numericData)
- {
- Console.WriteLine($"{_formater.Format(data)} | {_formater.Format(numericData)}");
- }
- }
- class User
- {
- public string Name;
- public int Money;
- public int Salary;
- }
- class Departament
- {
- public string Name;
- public int WorkerCount;
- public int AspirantCount;
- }
- }
Add Comment
Please, Sign In to add comment