public void AddEventsToOuting(Outing content)
 {
     _listOfOutings.Add(content);
 }
Example #2
0
        static void Main(string[] args)
        {
            Outing outing1 = new Outing(7, "10/10/2010", 25.00m, 175.00, (OutingType)1);
            Outing outing2 = new Outing(10, "12/12/2012", 15.00m, 150.00, (OutingType)2);
            Outing outing3 = new Outing(25, "01/01/2013", 50.00m, 1250.00, (OutingType)3);
            Outing outing4 = new Outing(10, "05/07/2014", 30.00m, 300.00, (OutingType)4);

            OutingRepository outingRepo = new OutingRepository();

            outingRepo.AddOutingToList(outing1);
            outingRepo.AddOutingToList(outing2);
            outingRepo.AddOutingToList(outing3);
            outingRepo.AddOutingToList(outing4);

            List <Outing> outings = outingRepo.GetList();

            while (true)
            {
                Console.WriteLine("Enter the NUMBER you would like to select:\n" +
                                  "1. Display all outings.\n" +
                                  "2. Add an outing. \n" +
                                  "3. View all costs of outings. \n" +
                                  "4. View costs of outings by type. \n" +
                                  "5. Exit program.\n");

                string optionAsString = Console.ReadLine();
                int    option         = int.Parse(optionAsString);

                if (option == 1)
                {
                    foreach (Outing outing in outings)
                    {
                        Console.WriteLine($"Number of attendees: { outing.People}\n" +
                                          $"Date of outing: {outing.Date}\n" +
                                          $"Cost per head: {outing.CostPerHead}\n" +
                                          $"Total cost of outing: {outing.OutingCost}\n" +
                                          $"Type of outing: {outing.Type}\n");
                    }
                }

                if (option == 2)
                {
                    while (true)
                    {
                        Console.WriteLine("Enter the number of attendees: ");
                        int people = int.Parse(Console.ReadLine());
                        Console.WriteLine("Enter the date of the outing: ");
                        string date = Console.ReadLine();
                        Console.WriteLine("Enter the cost per head: ");
                        decimal costperhead = Decimal.Parse(Console.ReadLine());
                        Console.WriteLine("Enter the total cost of the outing: ");
                        double outingcost = Double.Parse(Console.ReadLine());
                        Console.WriteLine("Enter the outing type:\n" +
                                          "1. Golf" +
                                          "2. Bowling" +
                                          "3. Skiing" +
                                          "4. Concert ");
                        int        type       = int.Parse(Console.ReadLine());
                        OutingType outingtype = (OutingType)type;

                        Outing userOuting = new Outing(people, date, costperhead, outingcost, outingtype);
                        outingRepo.AddOutingToList(userOuting);

                        Console.WriteLine("\n Would you like to add another outing? y/n");
                        string response = Console.ReadLine();
                        response = response.ToLower();
                        if (response == "y")
                        {
                        }
                        else if (response == "n")
                        {
                            break;
                        }
                    }
                }

                if (option == 3)
                {
                    double costTotal = 0;
                    foreach (var outing in outings)
                    {
                        costTotal += outing.OutingCost;
                    }
                    Console.WriteLine(costTotal);
                }

                if (option == 4)
                {
                    while (true)
                    {
                        Console.WriteLine("Enter the number of the event type whose cost you would like to check:\n" +
                                          "\t 1. Golf \n" +
                                          "\t 2. Bowling \n" +
                                          "\t 3. Skiing \n" +
                                          "\t 4. Concert \n");

                        string inputAsString = Console.ReadLine();
                        int    inputAsInt    = int.Parse(inputAsString);

                        if (inputAsInt == 1)
                        {
                            foreach (Outing outing in outings)
                            {
                                if (outing.Type == (OutingType)inputAsInt)
                                {
                                    double costOfGolf = 0;
                                    costOfGolf = costOfGolf + outing.OutingCost;
                                    Console.WriteLine(costOfGolf);
                                }
                            }
                        }

                        else if (inputAsInt == 2)
                        {
                            foreach (Outing outing in outings)
                            {
                                if (outing.Type == (OutingType)inputAsInt)
                                {
                                    double costOfBowling = 0;
                                    costOfBowling = costOfBowling + outing.OutingCost;
                                    Console.WriteLine(costOfBowling);
                                }
                            }
                        }

                        else if (inputAsInt == 3)
                        {
                            foreach (Outing outing in outings)
                            {
                                if (outing.Type == (OutingType)inputAsInt)
                                {
                                    double costOfSkiing = 0;
                                    costOfSkiing = costOfSkiing + outing.OutingCost;
                                    Console.WriteLine(costOfSkiing);
                                }
                            }
                        }

                        else if (inputAsInt == 4)
                        {
                            foreach (Outing outing in outings)
                            {
                                if (outing.Type == (OutingType)inputAsInt)
                                {
                                    double costOfConcert = 0;
                                    costOfConcert = costOfConcert + outing.OutingCost;
                                    Console.WriteLine(costOfConcert);
                                }
                            }
                        }
                        Console.WriteLine("\n Would you like to see another outing cost? y/n");
                        string response = Console.ReadLine();
                        response = response.ToLower();
                        if (response == "y")
                        {
                        }
                        else if (response == "n")
                        {
                            break;
                        }
                    }
                }

                if (option == 5)
                {
                    break;
                }
            }
        }
 public void AddOutingToList(Outing outing)
 {
     _listOfOutings.Add(outing);
 }
Example #4
0
 public void AddOutings(Outing outing)
 {
     _outings.Add(outing);
 }
Example #5
0
        public void Run()
        {
            _outings = _outingRepo.GetList();
            _outingRepo.SeedData();

            while (_response != 5)
            {
                PrintMenu();
                switch (_response)
                {
                case 1:
                    Console.WriteLine($"List of Outings\n\nOuting Type\tNumber Of People\tDate of Outing\t\tCost per Person\t\tTotal Cost");
                    foreach (Outing thisOuting in _outings)
                    {
                        Console.WriteLine($"{thisOuting.Category}\t\t{thisOuting.NumPpl} \t\t\t{thisOuting.DateOfEvent}\t\t${thisOuting.PerPersonCost}\t\t\t${thisOuting.TotalEventCost}");
                    }
                    break;

                case 2:
                    Console.WriteLine("Enter outing category: Golf = 1, Bowling = 2, Amusment Park = 3, Concert = 4, Other = 5");
                    int categoryInt = int.Parse(Console.ReadLine());
                    _type = _outingRepo.EventTypeSwitch(categoryInt);

                    Console.WriteLine("How manny people attended the event?");
                    var numPpl = int.Parse(Console.ReadLine());

                    Console.WriteLine("When was the event? mm/dd/yyyy");
                    var eventDate = Console.ReadLine();

                    Console.WriteLine("What was the cost per person?");
                    var    perPersonCost = decimal.Parse(Console.ReadLine());
                    var    totalCost     = perPersonCost * numPpl;
                    Outing outing        = new Outing(_type, numPpl, eventDate, perPersonCost, totalCost);

                    _outingRepo.AddToList(outing);
                    break;

                case 3:
                    List <Outing> listByType = _outingRepo.GetNewListByType();
                    Console.WriteLine("Enter desired outing type: Golf = 1, Bowling = 2, Amusment Park = 3, Concert = 4, Other = 5");
                    var desiredType = int.Parse(Console.ReadLine());
                    var outingType  = _outingRepo.EventTypeSwitch(desiredType);
                    _outingRepo.AddOutingToListByType(outingType);
                    Console.WriteLine("Total cost of desired outing = " + _outingRepo.ReturnDesiredCostByType());
                    break;

                case 4:
                    decimal sum = 0;
                    foreach (Outing thisOuting in _outings)
                    {
                        sum += thisOuting.TotalEventCost;
                    }
                    Console.WriteLine("The outstanding total cost is: $" + sum);
                    break;

                default:
                    Console.WriteLine("Please enter a correct value.");
                    break;
                }
                Console.WriteLine("Press any key to continue ...");
                Console.ReadKey();
            }
        }
        static void Main(string[] args)
        {
            OutingRepository outingRepo = new OutingRepository();

            DateTime renOneDate   = new DateTime(2016, 10, 15);
            DateTime renTwoDate   = new DateTime(2016, 11, 15);
            DateTime concertDate  = new DateTime(2017, 04, 03);
            DateTime puttPuttDate = new DateTime(2018, 06, 16);
            DateTime comicConDate = new DateTime(2018, 07, 17);

            Outing RenOne   = new Outing("Renaissance Festival", 15, renOneDate, 15m);
            Outing RenTwo   = new Outing("Renaissance Festival", 20, renTwoDate, 15m);
            Outing Concert  = new Outing("Concert", 10, concertDate, 65m);
            Outing PuttPutt = new Outing("Putt Putt Golf", 20, puttPuttDate, 15m);
            Outing ComicCon = new Outing("Comic Con", 12, comicConDate, 75m);

            outingRepo.AddOuting(RenOne);
            outingRepo.AddOuting(RenTwo);
            outingRepo.AddOuting(Concert);
            outingRepo.AddOuting(PuttPutt);
            outingRepo.AddOuting(ComicCon);

            bool cont = true;

            while (cont)
            {
                Console.Clear();
                Console.WriteLine($"Welcome to Komodo Outings! What would you like to do? (Please select the corresponding number):\n" +
                                  $"1) View All Outings\n" +
                                  $"2) Add Outing\n" +
                                  $"3) View Total Outing Costs\n" +
                                  $"4) View Total Outing Costs by Type\n" +
                                  $"5) Exit");
                string userAnswer = Console.ReadLine();

                switch (userAnswer)
                {
                case "1":
                    Console.Clear();
                    foreach (Outing outing in outingRepo.GetOutingList())
                    {
                        Console.WriteLine($"Outing Type: {outing.OutingType}\n" +
                                          $"Total People in attendance: {outing.TotalPeople}\n" +
                                          $"Date of Outing: {outing.Date.ToShortDateString()}\n" +
                                          $"Cost per Person: {outing.CostPerson}\n" +
                                          $"Total Cost of Outing: {outing.CostOuting}\n");
                    }
                    Console.ReadLine();

                    Console.Clear();
                    Console.WriteLine("Is there anything else I can help you with? (y/n)");
                    string Answer = Console.ReadLine();
                    if (Answer == "y")
                    {
                    }
                    else
                    {
                        (cont) = false;
                        Console.Clear();
                        Console.WriteLine("Goodbye!");
                        break;
                    }
                    break;

                case "2":
                    Console.Clear();
                    Console.WriteLine("Enter the event type:");
                    string outingType = Console.ReadLine();

                    Console.WriteLine("Enter the total number of people attending the event:");
                    string totalPeopleString = Console.ReadLine();
                    int    totalPeople       = Int32.Parse(totalPeopleString);

                    Console.WriteLine("Enter the date of the outing (MM/DD/YYYY):");
                    string   dateString = Console.ReadLine();
                    DateTime date       = DateTime.Parse(dateString);

                    Console.WriteLine("Enter the cost per person:");
                    string  costPersonString = Console.ReadLine();
                    decimal costPerson       = decimal.Parse(costPersonString);

                    Console.WriteLine($"The total cost of this outing is: {totalPeople*costPerson}");

                    Outing userInput = new Outing(outingType, totalPeople, date, costPerson);
                    outingRepo.AddOuting(userInput);

                    Console.Clear();
                    Console.WriteLine("Thank you! Your outing has been added to the Komodo Outings List.");
                    Console.ReadLine();
                    break;

                case "3":
                    Console.Clear();
                    Console.WriteLine("The combined cost of all outings is $" + outingRepo.CombineOutingCosts());
                    Console.ReadLine();
                    break;

                case "4":
                    Console.Clear();
                    Console.WriteLine("What outing type do you need the total cost for?");
                    string type = Console.ReadLine();
                    Console.WriteLine("The combined cost of all " + type + " outings is $" + outingRepo.CombineOutingByType(type));
                    Console.ReadLine();
                    break;

                case "5":
                    (cont) = false;
                    Console.Clear();
                    Console.WriteLine("Goodbye!");
                    Console.ReadLine();
                    break;

                default:
                    break;
                }
            }
        }
Example #7
0
 public void AddOutingsToList(Outing outing)
 {
     _outingList.Add(outing);
 }
Example #8
0
 public void UpdateList(Outing outing)
 {
     _outingList.Add(outing);
 }
Example #9
0
 public void AddEventToList(Outing outing)
 {
     eventList.Add(outing);
 }
        public void Run()
        {
            while (isRunning)
            {
                string        input   = Menu();
                List <Outing> outings = outingRepo.GetOutings();
                switch (input)
                {
                case "1":
                    Console.WriteLine("Event Type\t" +
                                      "Attended\t" +
                                      "Date\t\t" +
                                      "Total Cost\t" +
                                      "Cost per Person");
                    foreach (Outing outing in outings)
                    {
                        Console.WriteLine(outing);
                    }
                    break;

                case "2":
                    Outing _outing = AddOuting();
                    outingRepo.AddOutings(_outing);
                    Console.Clear();
                    break;

                case "3":
                    Console.WriteLine("Which total cost would you like to view?\n" +
                                      "1. Total Cost of all outings\n" +
                                      "2. Total Cost of each outing type\n");
                    string input3 = Console.ReadLine();
                    Console.Clear();

                    switch (input3)
                    {
                    case "1":
                        decimal total = outingRepo.TotalCost(outings);
                        Console.WriteLine($"The total cost of all outings is: {total}");
                        Console.WriteLine("\nPress Enter to continue...");
                        Console.ReadLine();
                        Console.Clear();
                        break;

                    case "2":
                        EventTypes eventType = new EventTypes();
                        bool       isRunning = true;
                        while (isRunning)
                        {
                            Console.WriteLine("Select Event Type\n" +
                                              "1. Golf\n" +
                                              "2. Bowling\n" +
                                              "3. Amusement Park\n" +
                                              "4. Concert\n");
                            string typeInput = Console.ReadLine();
                            Console.Clear();
                            switch (typeInput)
                            {
                            case "1":
                                eventType = EventTypes.Golf;
                                isRunning = false;
                                Console.Clear();
                                break;

                            case "2":
                                eventType = EventTypes.Bowling;
                                isRunning = false;
                                Console.Clear();
                                break;

                            case "3":
                                eventType = EventTypes.Park;
                                isRunning = false;
                                Console.Clear();
                                break;

                            case "4":
                                eventType = EventTypes.Concert;
                                isRunning = false;
                                Console.Clear();
                                break;

                            default:
                                Console.WriteLine("Error: Select defined option");
                                break;
                            }
                        }
                        decimal totalC = outingRepo.TotalCostByType(outings, eventType);
                        Console.WriteLine($"The total cost of all {eventType} outings is: {totalC}");
                        Console.WriteLine("\nPress any key to continue");
                        Console.ReadKey();
                        Console.Clear();
                        break;

                    default:
                        break;
                    }
                    break;

                case "4":
                    isRunning = false;
                    break;

                default:
                    break;
                }
            }
        }
Example #11
0
 public void AddToOutingList(Outing outing)
 {
     _outingList.Add(outing);
 }
 public void AddOutingToList(Outing content)
 {
     _listofOutings.Add(content);
 }
        public void Run()
        {
            _outingList = outingRepo.GetOutings();
            Outing outingOne   = new Outing("Golf", 24, "5/25/2018", 25.00m, 600.00m);
            Outing outingTwo   = new Outing("Bowling", 16, "3/15/2018", 15.00m, 240.00m);
            Outing outingThree = new Outing("Amusement Park", 57, "7/15/2018", 24.00m, 1368.00m);
            Outing outingFour  = new Outing("Golf", 36, "7/29/2018", 35.00m, 1260.00m);
            Outing outingFive  = new Outing("Concert", 45, "9/13/2018", 37.00m, 1665.00m);
            Outing outingSix   = new Outing("Bowling", 20, "8/15/2018", 15.00m, 300.00m);

            outingRepo.AddOutingToList(outingOne);
            outingRepo.AddOutingToList(outingTwo);
            outingRepo.AddOutingToList(outingThree);
            outingRepo.AddOutingToList(outingFour);
            outingRepo.AddOutingToList(outingFive);
            outingRepo.AddOutingToList(outingSix);

            bool isRunning = true;

            while (isRunning)
            {
                Console.WriteLine("What would you like to do?\n\t" +
                                  "1 Add an Event\n\t" +
                                  "2 Print a List of All Events\n\t" +
                                  "3 View Total Costs by Event Type\n\t" +
                                  "4 View Total Costs\n\t" +
                                  "5 Exit");
                int input = outingRepo.ParseResponseToInt();

                switch (input)
                {
                case 1:
                    var outing = CreateNewOuting();
                    outingRepo.AddOutingToList(outing);
                    isRunning = true;
                    break;

                case 2:
                    PrintOutingListString();
                    isRunning = true;
                    break;

                case 3:
                    CalculateTotalCostsByEvent();
                    isRunning = true;
                    break;

                case 4:
                    CalculateTotalCombinedEventCost();
                    isRunning = true;
                    break;

                case 5:
                    Console.WriteLine("Thank you!");
                    isRunning = false;
                    break;

                default:
                    break;
                }
            }
        }
Example #14
0
        public void AddOuting(EventType type, int attendees, DateTime date, decimal individualCost, decimal totalEventCost)
        {
            Outing newOuting = new Outing(type, attendees, date, individualCost, totalEventCost);

            _outingList.Add(newOuting);
        }
 public void AddOuting(Outing outing)
 {
     outingsList.Add(outing);
 }