Пример #1
0
 public Outings(TypeOfOutings type, double cpp, DateTime ed, int noppl)
 {
     Type           = type;
     CostPerPerson  = cpp;
     EventDate      = ed;
     NumberOfPeople = noppl;
     TotalCost      = cpp * noppl;
 }
Пример #2
0
        public double CostByType(TypeOfOutings OType)
        {
            double totalCost = 0;

            foreach (Outings item in listOfOutings)
            {
                if (item.Type == OType)
                {
                    totalCost += item.TotalCost;
                }
            }
            return(totalCost);
        }
Пример #3
0
        public void TotalCostByType()
        {
            List <Outings> outingList = _outingsRepository.GetOutingList();
            int            choice;
            double         totalCost = 0;

            Console.WriteLine("Please select which type you would like to get it's total:\n" +
                              "1. Golf" +
                              "2. Bowling\n" +
                              "3. Amusement Park\n" +
                              "4. Concert\n");

            choice = int.Parse(Console.ReadLine());

            TypeOfOutings outing = TypeOfOutings.AmusementPark;

            switch (choice)
            {
            case 1:
                outing = TypeOfOutings.Golf;
                break;

            case 2:
                outing = TypeOfOutings.Bowling;
                break;

            case 3:
                outing = TypeOfOutings.AmusementPark;
                break;

            case 4:
                outing = TypeOfOutings.Concert;
                break;
            }

            totalCost = _outingsRepository.CostByType(outing);
            Console.WriteLine($"Total cost of the selected type is: {totalCost}");
            Run();
        }