-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
144 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace lab7 | ||
{ | ||
public class Cashier : Employee | ||
{ | ||
public string Qualification { get; set; } | ||
|
||
public override string GetFullName() | ||
{ | ||
return base.GetFullName() + " | " + Qualification; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.VisualBasic; | ||
|
||
namespace lab7 | ||
{ | ||
public class Commander | ||
{ | ||
public Commander() | ||
{ | ||
Employees = new List<Employee>(); | ||
TomorrowEmployees = new List<Employee>(); | ||
} | ||
|
||
public List<Employee> Employees { get; set; } | ||
public List<Employee> TomorrowEmployees { get; set; } | ||
|
||
public void PrintTeam() | ||
{ | ||
_printHr(); | ||
_printMiddle("Завтрашняя смена"); | ||
_printHr(); | ||
foreach (Employee employee in TomorrowEmployees) | ||
{ | ||
_print(employee.GetFullName()); | ||
} | ||
_printHr(); | ||
} | ||
|
||
public static void PrintBage(Cashier cashier) | ||
{ | ||
_printHr(); | ||
_printMiddle("Кассир Командора"); | ||
_printHr(); | ||
_print(cashier.GetFullName()); | ||
_printHr(); | ||
} | ||
|
||
public void PrintBageForAllCashiers() | ||
{ | ||
foreach (Employee employee in Employees) | ||
{ | ||
if (employee is not Cashier) | ||
{ | ||
continue; | ||
} | ||
|
||
_printHr(); | ||
_printMiddle("Кассир Командора"); | ||
_printHr(); | ||
_print(employee.GetFullName()); | ||
_printHr(); | ||
|
||
Console.WriteLine(); | ||
} | ||
} | ||
|
||
private static void _printHr() | ||
{ | ||
Console.WriteLine("+" + new string('-', 50) + "+"); | ||
} | ||
|
||
private static void _print(string text) | ||
{ | ||
Console.WriteLine("| " + text + new string(' ', 50-2-text.Length) + " |"); | ||
} | ||
|
||
private static void _printMiddle(string text) | ||
{ | ||
Console.WriteLine("| " + new string(' ', (50-2-text.Length)/2) + text + new string(' ', (50-2-text.Length)/2 + (50-2-text.Length)%2) + " |"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
|
||
namespace lab7 | ||
{ | ||
public class Employee | ||
{ | ||
public string FirstName { get; set; } | ||
public string LastName { get; set; } | ||
|
||
public virtual string GetFullName() | ||
{ | ||
return $"{FirstName} {LastName}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace lab7 | ||
{ | ||
public class Loader : Employee | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
|
||
namespace lab7 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
string[] names = {"Иван", "Владимир", "Михаил", "Алексей", "Кирилл", "Матвей", "Костя", "Виктор", "Денис", "Николай", "Александр"}; | ||
string[] surnames = {"Ванюшкин", "Курусь", "Кибалин", "Викторов", "Нагель", "Казимирский", "Поздняков", "Пенский", "Калинин", "Ткачев", "Скурихин"}; | ||
string[] qualifications = {"стажер", "кассир", "старший кассир"}; | ||
|
||
Commander commander = new Commander(); | ||
|
||
Random random = new Random(); | ||
for (int i = 0; i < 8; i++) | ||
{ | ||
Cashier cashier = new Cashier(); | ||
cashier.Qualification = qualifications[random.Next(qualifications.Length)]; | ||
|
||
cashier.FirstName = names[random.Next(names.Length)]; | ||
cashier.LastName = surnames[random.Next(surnames.Length)]; | ||
commander.Employees.Add(cashier); | ||
} | ||
|
||
commander.PrintBageForAllCashiers(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net5.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file was deleted.
Oops, something went wrong.