Exemplo n.º 1
0
        static void Main(string[] args)
        {
            OutingRepository outings = new OutingRepository();

            outings.AddOuting(new Outing(EventType.AmusementPark, 30, new DateTime(2010, 10, 10), 30M));

            OutingsMenu menu = new OutingsMenu(outings);

            menu.Run();
        }
Exemplo n.º 2
0
        private static void AddNewOuting()
        {
            Console.WriteLine("What type of outing is this?");
            Console.WriteLine("      [1] Golf");
            Console.WriteLine("      [2] Bowling");
            Console.WriteLine("      [3] Amusement Park");
            Console.WriteLine("      [4] Concert");

            Outing.EventType eventtype;
            while (true)
            {
                string chosen = Input("Input [#]: ");

                if (chosen == "1")
                {
                    eventtype = Outing.EventType.Golf;
                }

                else if (chosen == "2")
                {
                    eventtype = Outing.EventType.Bowling;
                }

                else if (chosen == "3")
                {
                    eventtype = Outing.EventType.AmusementPark;
                }

                else if (chosen == "4")
                {
                    eventtype = Outing.EventType.Concert;
                }

                else
                {
                    continue;
                }

                break;
            }

            Console.WriteLine();
            DateTime dateofevent  = DateTime.Parse(Input("What is the date of this event (MM/DD/YYYY)? "));
            int      numattendees = int.Parse(Input("How many people are attending this event? "));
            double   ticketcost   = Math.Round(double.Parse(Input("How much is one ticket to this outing? $")), 2);

            Outing new_outing = new Outing(eventtype, dateofevent, numattendees, ticketcost);

            OutingRepository.AddOutingToList(new_outing);

            Console.WriteLine();
            Console.WriteLine("Your outing has been added to the list!");
            Input("Press enter/return ");
        }
Exemplo n.º 3
0
        private void SeedData()
        {
            Outing event1 = new Outing("Bowling", 4, DateTime.Now, 19.99m, 19.99m * 4); // 79.96
            Outing event2 = new Outing("Bowling", 3, DateTime.Now, 19.99m, 19.99m * 3); //59.97
            Outing event3 = new Outing("Golf", 2, DateTime.Now, 39.99m, 39.99m * 2);    //79.98
            Outing event4 = new Outing("Concert", 6, DateTime.Now, 49.99m, 49.99m * 6); // 299.94

            OutingRepository repo = new OutingRepository();

            _repo.AddOuting(event1);
            _repo.AddOuting(event2);
            _repo.AddOuting(event3);
            _repo.AddOuting(event4);
        }
Exemplo n.º 4
0
        private static void GetOutingCosts()
        {
            double total_golf    = 0;
            double total_bowling = 0;
            double total_park    = 0;
            double total_concert = 0;

            foreach (Outing outing in OutingRepository.GetList())
            {
                if (outing.TypeOfEvent == Outing.EventType.Golf)
                {
                    total_golf += outing.TotalCost;
                }

                else if (outing.TypeOfEvent == Outing.EventType.Bowling)
                {
                    total_bowling += outing.TotalCost;
                }

                else if (outing.TypeOfEvent == Outing.EventType.AmusementPark)
                {
                    total_park += outing.TotalCost;
                }

                else if (outing.TypeOfEvent == Outing.EventType.Concert)
                {
                    total_concert += outing.TotalCost;
                }
            }

            total_golf    = Math.Round(total_golf, 2);
            total_bowling = Math.Round(total_bowling, 2);
            total_park    = Math.Round(total_park, 2);
            total_concert = Math.Round(total_concert, 2);
            double total_all = Math.Round(total_golf + total_bowling + total_park + total_concert, 2);

            Console.WriteLine("Here are the total revenues for all outings: ");
            Console.WriteLine($"    Golf: ${total_golf}");
            Console.WriteLine($"    Bowling: ${total_bowling}");
            Console.WriteLine($"    Amusement Park: ${total_park}");
            Console.WriteLine($"    Concert: ${total_concert}");
            Console.WriteLine($"Total: ${total_all}");
            Console.WriteLine();
            Input("Press enter/return when you're finished viewing this list");
        }
Exemplo n.º 5
0
        private static void ViewOutingList()
        {
            int counter = 1;

            foreach (Outing outing in OutingRepository.GetList())
            {
                Console.WriteLine($"Outing #{counter} details: ");
                Console.WriteLine($"    Event Type: {outing.TypeOfEvent.ToString()}");
                Console.WriteLine($"    Date of Event: {outing.DateOfEvent.ToString("MM/dd/yyyy")}");
                Console.WriteLine($"    Number of Attendees: {outing.NumAttendees}");
                Console.WriteLine($"    Ticket Cost: ${outing.TicketCost}");
                Console.WriteLine($"    Total Revenue: ${outing.TotalCost}");
                Console.WriteLine();
                counter++;
            }

            Input("Press enter/return when you're finished viewing this list");
        }
Exemplo n.º 6
0
        public static void Main(string[] args)
        {
            Outings one   = new Outings((Event)1, 5, "11/20/1986", 10, 50);
            Outings two   = new Outings((Event)2, 10, "11/20/1986", 15, 150);
            Outings three = new Outings((Event)3, 5, "11/20/1986", 20, 100);
            Outings four  = new Outings((Event)4, 10, "11/20/1986", 50, 500);
            Outings five  = new Outings((Event)1, 10, "11/20/1986", 20, 200);

            OutingRepository _outsRepo = new OutingRepository();

            _outsRepo.AddOutingToList(one);
            _outsRepo.AddOutingToList(two);
            _outsRepo.AddOutingToList(three);
            _outsRepo.AddOutingToList(four);
            _outsRepo.AddOutingToList(five);

            while (true)
            {
                Console.WriteLine("Hi, manager. Please select what you would like to do.\n" +
                                  "Select 1 to Display a list of all outings.\n" +
                                  "Select 2 to Add individual outings to a list.\n" +
                                  "Select 3 to calculate cost of all outings.\n" +
                                  "Select 4 to calculate cost of outings by type.");
                string theAnswer = Console.ReadLine();

                if (theAnswer == "1")
                {
                    List <Outings> groupout = _outsRepo.GetList();

                    Console.WriteLine("Press enter to view the menu list:");

                    Console.ReadLine();

                    foreach (Outings outing in groupout)
                    {
                        Console.WriteLine($"Event Type: {outing.Type}\n" +
                                          $"Number of People: {outing.People}\n" +
                                          $"Date of Outing: {outing.Date}\n" +
                                          $"Cost Per Person: {outing.Person}\n" +
                                          $"Total Cost: {outing.Total}\n");
                    }
                }

                if (theAnswer == "2")
                {
                    Console.WriteLine("Enter the type of event:");
                    int usetype = int.Parse(Console.ReadLine());
                    Console.WriteLine("Enter number of people that went on the outing:");
                    int usepeople = int.Parse(Console.ReadLine());
                    Console.WriteLine("Enter the date of the outing:");
                    string dateout = Console.ReadLine();
                    Console.WriteLine("Enter the cost per person:");
                    double personcost = double.Parse(Console.ReadLine());
                    Console.WriteLine("Enter the total cost of this outing");
                    int totalcost = int.Parse(Console.ReadLine());

                    Event eventin = (Event)usetype;

                    Outings usercake = new Outings(eventin, usepeople, dateout, personcost, totalcost);

                    _outsRepo.AddOutingToList(usercake);
                }

                if (theAnswer == "3")
                {
                    Console.WriteLine($"The total for all outings is: {_outsRepo.TotalAllOutings()}");
                    Console.ReadLine();
                }

                if (theAnswer == "4")
                {
                    while (true)
                    {
                        Console.WriteLine("What type of event would you like to see the totals for?\n" +
                                          "Press 1 for Golf.\n" +
                                          "Press 2 for Bowling.\n" +
                                          "Press 3 for Amusement Park.\n" +
                                          "Press 4 for Concert.\n" +
                                          "Press 5 for Undefined Event. ");
                        string userinput = Console.ReadLine();

                        if (userinput == "1")
                        {
                            Console.WriteLine($"The total amount spent on Skate outings is: {_outsRepo.TotalAllOutingsByType(Event.Skate)}");
                        }

                        if (userinput == "2")
                        {
                            Console.WriteLine($"The total amount spent on bowling outings is {_outsRepo.TotalAllOutingsByType(Event.Snowboarding)}");
                        }

                        if (userinput == "3")
                        {
                            Console.WriteLine($"The total amount spent on Amusement Park outings is: {_outsRepo.TotalAllOutingsByType(Event.Skydiving)}");
                        }

                        if (userinput == "4")
                        {
                            Console.WriteLine($"The total amount spent on Concert outings is: {_outsRepo.TotalAllOutingsByType(Event.Concert)}");
                        }

                        if (userinput == "5")
                        {
                            Console.WriteLine($"The total amount spent on Undefined outings is: {_outsRepo.TotalAllOutingsByType(Event.Misc)}");
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
 public ProgramUI(IConsole console)
 {
     _outingRepo = new OutingRepository();
     _console    = console;
 }
Exemplo n.º 8
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;
                }
            }
        }
Exemplo n.º 9
0
 public OutingsMenu(OutingRepository repo)
 {
     this.repo = repo;
 }
Exemplo n.º 10
0
        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;
                }
            }
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            OutingRepository outingRepo = new OutingRepository();
            List <Outing>    outingList = outingRepo.GetList();

            string response = null;

            while (response != "4")
            {
                Console.Clear();
                Console.WriteLine($"What would you like to do? \n1. View all outings \n2. Create new outing \n3. Calculate costs \n4. Exit");
                response = Console.ReadLine();

                if (response == "1")
                {
                    Console.Clear();
                    if (outingList.Count == 0)
                    {
                        Console.WriteLine("There are currently no events recorded.");
                    }
                    else
                    {
                        foreach (Outing outing in outingList)
                        {
                            Console.WriteLine(outing);
                        }
                    }
                    Console.Read();
                }
                else if (response == "2")
                {
                    Console.Clear();
                    Console.WriteLine($"Select an outing type:\n" +
                                      $"1. Amusement Park\n" +
                                      $"2. Bowling\n" +
                                      $"3. Concert\n" +
                                      $"4. Golf");
                    int       input      = Int32.Parse(Console.ReadLine());
                    EventType newEvent   = EventType.AmusementPark;
                    string    typeHeader = null;
                    switch (input)
                    {
                    case 1:
                        newEvent   = EventType.AmusementPark;
                        typeHeader = "Amusement Park Event";
                        break;

                    case 2:
                        newEvent   = EventType.Bowling;
                        typeHeader = "Bowling Event";
                        break;

                    case 3:
                        newEvent   = EventType.Concert;
                        typeHeader = "Concert Event";
                        break;

                    case 4:
                        newEvent   = EventType.Golf;
                        typeHeader = "Golf Event";
                        break;

                    default:
                        Console.WriteLine("Invalid input");
                        break;
                    }
                    Console.Clear();
                    Console.WriteLine(typeHeader);
                    Console.Write("Enter the amount of attendees: ");
                    int attendance = Int32.Parse(Console.ReadLine());

                    Console.Write($"Enter the Month, Day, and Year of the event: " +
                                  $"\n Month (MM): ");
                    int newMonth = Int32.Parse(Console.ReadLine());
                    Console.Write(" Day (DD): ");
                    int newDay = Int32.Parse(Console.ReadLine());
                    Console.Write(" Year (YYYY): ");
                    int      newYear = Int32.Parse(Console.ReadLine());
                    DateTime date    = new DateTime(newYear, newMonth, newDay);

                    Console.Write("Enter the cost per individual for the event: $");
                    decimal individualCost = Decimal.Parse(Console.ReadLine());

                    Console.Write("Enter the total cost for the event: $");
                    decimal totalEventCost = Decimal.Parse(Console.ReadLine());

                    outingRepo.AddOuting(newEvent, attendance, date, individualCost, totalEventCost);

                    Console.Read();
                }
                else if (response == "3")
                {
                    Console.Clear();
                    Console.WriteLine($"What calculations would you like to do? \n1. Total costs for all outings \n2. Total oosts for outings of a specific type");
                    string calcResponse = Console.ReadLine();
                    if (calcResponse == "1")
                    {
                        Console.Clear();
                        Console.WriteLine($"Total cost for all outings: ${outingRepo.TotalCost()}");
                    }
                    else if (calcResponse == "2")
                    {
                        Console.Clear();
                        Console.WriteLine($"Enter the outing type would you like to sort by:" +
                                          $"\n1. Amusement Park" +
                                          $"\n2. Bowling" +
                                          $"\n3. Concert" +
                                          $"\n4. Golf");
                        var       typeNum = Int32.Parse(Console.ReadLine());
                        EventType type    = EventType.AmusementPark;
                        switch (typeNum)
                        {
                        case 1:
                            type = EventType.AmusementPark;
                            break;

                        case 2:
                            type = EventType.Bowling;
                            break;

                        case 3:
                            type = EventType.Concert;
                            break;

                        case 4:
                            type = EventType.Golf;
                            break;

                        default:
                            Console.WriteLine("Error");
                            break;
                        }
                        Console.Clear();
                        Console.WriteLine($"Total cost for {type}: ${outingRepo.GetCostByType(type)}");
                    }
                    Console.Read();
                }
                else if (response == "4")
                {
                    break;
                }
            }
        }
Exemplo n.º 12
0
        public static void ChooseAnOption()
        {
            while (true)
            {
                Console.WriteLine(divider);
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("      [1] Add a new outing");
                Console.WriteLine("      [2] View list of outings");
                Console.WriteLine("      [3] Get Outing Costs");
                Console.WriteLine("      [4] Exit Program");

                while (true)
                {
                    string chosen = Input("Input [#]: ");

                    if (chosen == "1")
                    {
                        Console.WriteLine(divider);
                        AddNewOuting();
                        break;
                    }

                    else if (chosen == "2")
                    {
                        Console.WriteLine(divider);
                        if (OutingRepository.GetList().Count > 0)
                        {
                            ViewOutingList();
                        }

                        else
                        {
                            Console.WriteLine("You have not added any outings yet.");
                            Input("Press enter/return ");
                        }

                        break;
                    }

                    else if (chosen == "3")
                    {
                        Console.WriteLine(divider);
                        if (OutingRepository.GetList().Count > 0)
                        {
                            GetOutingCosts();
                        }

                        else
                        {
                            Console.WriteLine("You have not added any outings yet.");
                            Input("Press enter/return ");
                        }

                        break;
                    }

                    else if (chosen == "4")
                    {
                        System.Environment.Exit(1);
                    }
                }
            }
        }