Flu3nt

Untitled

May 17th, 2019
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. namespace AutoRepairAndService
  2. {
  3.     using System;
  4.     using System.Collections;
  5.     using System.Collections.Generic;
  6.     using System.Linq;
  7.  
  8.     public class StartUp
  9.     {
  10.         public static void Main(string[] args)
  11.         {
  12.             string[] carModels = Console.ReadLine()
  13.                 .Split(" ", StringSplitOptions.RemoveEmptyEntries);
  14.  
  15.             Queue<string> queueOfCars = new Queue<string>(carModels);
  16.             Stack<string> servedCars = new Stack<string>();
  17.  
  18.             string input = Console.ReadLine();
  19.  
  20.             while (input != "end")
  21.             {
  22.                 if (input == "Service" && queueOfCars.Count > 0)                      
  23.                 {
  24.                     string currentCar = queueOfCars.Dequeue();
  25.                     servedCars.Push(currentCar);
  26.                     Console.WriteLine($"Vehicle {currentCar} got served.");
  27.                 }
  28.                 else if (input.Contains("CarInfo"))
  29.                 {
  30.                     string carName = input.Split('-'[1]);
  31.                 }
  32.  
  33.                 input = Console.ReadLine();
  34.             }
  35.                        
  36.            
  37.        
  38.                
  39.         }
  40.     }
  41. }
Add Comment
Please, Sign In to add comment