Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Dynamic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TaxiManagement
- {
- public class TaxiManager
- {
- private SortedDictionary<int,Taxi> taxi = new SortedDictionary<int, Taxi>();
- public Taxi CreateTaxi(int taxiNum)
- {
- Console.WriteLine("CreateTaxi Called");
- Console.WriteLine(taxiNum);
- if (taxi.ContainsKey(taxiNum))
- {
- return taxi[taxiNum];
- }
- else
- {
- taxi.Add(taxiNum, new Taxi(taxiNum));
- return new Taxi(taxiNum);
- }
- }
- public Taxi FindTaxi(int taxiNum)
- {
- Console.WriteLine("FindTaxi Called");
- if (taxi.ContainsKey(taxiNum))
- {
- return taxi[taxiNum];
- }
- else
- {
- CreateTaxi(taxiNum);
- return null;
- }
- }
- public SortedDictionary<int, Taxi> GetAllTaxis()
- {
- Console.WriteLine("GetAllTaxi Called");
- return taxi;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement