Exemplo n.º 1
0
        public void Input(string manufacturer, string model, uint amount, double price)
        {
            CarDealer carDealer = CarDealer.GetInstance();

            for (int i = 0; i < amount; i++)
            {
                carDealer.AddCar(new Car(manufacturer, model, price));
            }
        }
Exemplo n.º 2
0
        public string CalculateAveragePrice(string type)
        {
            double amount = CarDealer.GetInstance().Cars.Where(x => x.Manufacturer == type).Count();

            if (amount > 0)
            {
                double sumPrice = CarDealer.GetInstance().Cars.Where(x => x.Manufacturer == type).Select(x => x.Price).Sum();
                return((sumPrice / amount).ToString());
            }
            else
            {
                return("There're any cars of this manufacturer added!");
            }
        }
Exemplo n.º 3
0
        public string CalculateAveragePrice()
        {
            double amount = CarDealer.GetInstance().Cars.Count();

            if (amount > 0)
            {
                double sumPrice = CarDealer.GetInstance().Cars.Select(x => x.Price).Sum();
                return((sumPrice / amount).ToString());
            }
            else
            {
                return("There're any cars added!");
            }
        }
Exemplo n.º 4
0
 public string CountTypes()
 {
     return(CarDealer.GetInstance().Cars.Select(x => x.Manufacturer).Distinct().Count().ToString());
 }
Exemplo n.º 5
0
 public string CountAll()
 {
     return(CarDealer.GetInstance().Cars.Count.ToString());
 }