Advertisement
VssA

bus

Jan 10th, 2024
1,148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.91 KB | None | 0 0
  1. using Optimizer.Domain.Bus;
  2. using Optimizer.Domain.Bus.Entities;
  3. using Optimizer.Domain.Bus.ValueObjects;
  4. using Optimizer.Domain.Route;
  5. using Optimizer.Domain.Route.ValueObjects;
  6. using Optimizer.PathMaker.RouteMaker;
  7. using Optimizer.PathMaker.Randomizer;
  8. using System.Net.Http.Headers;
  9. using Optimizer.Domain.Common.Entities;
  10.  
  11. /*var bus = Bus.Create(100, PlateNumber.Create("asd"));
  12. var busStation = BusStation.Create("Station1");
  13. var arrivalTimes = new List<ArrivalTime> { ArrivalTime.Create(busStation, DateTime.UtcNow) };
  14. var route = Route<Bus, BusId>.Create(bus, arrivalTimes);
  15. bus.AddRoute(route);*/
  16.  
  17. internal class Program
  18. {
  19.     private static void Main(string[] args)
  20.     {
  21.         Random random = new Random();
  22.  
  23.         var bus = Bus.Create(random.Next(50, 100), PlateNumber.Create("AB" + random.Next(1000, 9999)));
  24.  
  25.         var station = BusStation.Create("Station" + random.Next(1, 10));
  26.  
  27.         List<ArrivalTime> arrivalTimes = new List<ArrivalTime>();
  28.  
  29.         for (int i = 0; i < 6; i++)
  30.         {
  31.             DateTime time = new DateTime(random.Next(2024,2024), random.Next(1,12), random.Next(1, 31), random.Next(0, 12), random.Next(0, 60), random.Next(0, 60));
  32.             arrivalTimes.Add(ArrivalTime.Create(station, time));
  33.         }
  34.  
  35.         var route = Route<Bus, BusId>.Create(bus, arrivalTimes);
  36.  
  37.         // Вывод сгенерированных данных
  38.         Console.WriteLine("Сгенерированный автобус Максимальное количество пассажиров - " + bus.MaxPassengersCount + ", Номер - " + bus.PlateNumber.Number);
  39.         Console.WriteLine("Сгенерированная остановка Название - " + station.StationName);
  40.         Console.WriteLine("Времена прибытия:");
  41.         foreach (var time in route.ArrivalTimes)
  42.         {
  43.             Console.WriteLine(time.Time);
  44.         }
  45.  
  46.     }  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement