Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace AutoRepairAndService
- {
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- public class StartUp
- {
- public static void Main(string[] args)
- {
- string[] carModels = Console.ReadLine()
- .Split(" ", StringSplitOptions.RemoveEmptyEntries);
- Queue<string> queueOfCars = new Queue<string>(carModels);
- Stack<string> servedCars = new Stack<string>();
- string input = Console.ReadLine();
- while (input != "end")
- {
- if (input == "Service" && queueOfCars.Count > 0)
- {
- string currentCar = queueOfCars.Dequeue();
- servedCars.Push(currentCar);
- Console.WriteLine($"Vehicle {currentCar} got served.");
- }
- else if (input.Contains("CarInfo"))
- {
- string carName = input.Split('-'[1]);
- }
- input = Console.ReadLine();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment