Ejemplo n.º 1
0
        public void AddNewOuting()
        {
            Console.Clear();

            Console.WriteLine("Enter Event Type (Golf, Bowling, Amusement Park, Concert):");
            string eventType = Console.ReadLine();

            Console.WriteLine("Enter number of people who attended:");
            string peopleAttendedAsString = Console.ReadLine();
            int    peopleAttended         = Int32.Parse(peopleAttendedAsString);

            Console.WriteLine("Total cost for event:");
            string costPerEventAsString = Console.ReadLine();
            double costPerEvent         = Double.Parse(costPerEventAsString);

            Console.WriteLine("Date of Event (MM,DD,YY):");
            string   dateAsString = Console.ReadLine();
            DateTime date         = DateTime.Parse(dateAsString);

            Outings newOuting = new Outings(eventType, peopleAttended, date, costPerEvent);

            Console.WriteLine($"Here are the details for your outing:\r\n");
            Console.WriteLine(newOuting);

            _outingRepo.AddOutingToList(newOuting);

            Console.WriteLine("Your Outing has been successfully added!");

            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public void RunMenu()
        {
            Outings disneyWorld = new Outings(OutingType.AmusementPark, 5, "06/15/2012", 100.00m, 500.00m);
            Outings shinedown   = new Outings(OutingType.Concert, 10, "05/20/2015", 50.00m, 500.00m);
            Outings sixFlags    = new Outings(OutingType.AmusementPark, 25, "02/06/2016", 100.00m, 2500.00m);

            _outingsRepo.AddOutingtoList(sixFlags);
            _outingsRepo.AddOutingtoList(disneyWorld);
            _outingsRepo.AddOutingtoList(shinedown);
            bool isRunning = true;

            while (isRunning)
            {
                Console.WriteLine("Choose a menu option:" +
                                  "\n1. See All Outings List" +
                                  "\n2. Add Outing to List" +
                                  "\n3. See Cost for All Outings" +
                                  "\n4. See Cost by Outing Type" +
                                  "\n5. Exit");
                int input = int.Parse(Console.ReadLine());
                switch (input)
                {
                case 1:     //List all outings
                    ShowAllOutings();
                    break;

                case 2:     //Add outing to list
                    AddOuting();
                    break;

                case 3:     //See Total cost
                    Console.Clear();
                    Console.WriteLine($"The total cost is {_outingsRepo.CalculateTotalCost():c}");
                    Console.ReadLine();
                    break;

                case 4:     //See cost per type
                    CostByType();
                    break;

                case 5:     //Exit
                    isRunning = false;
                    Console.ReadLine();
                    break;

                default:
                    Console.WriteLine("Please enter in a valid option!!");
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public void AddOuting()
        {
            Console.Clear();
            Outings newOuting = new Outings();

            Console.WriteLine("What type of Outing was Taken?" +
                              "\n1. MiniGolf" +
                              "\n2. Arcade" +
                              "\n3. GoKarting" +
                              "\n4. Boating");

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

            switch (input)
            {
            case 1:
                newOuting.OutingType = OutingType.MiniGolf;
                break;

            case 2:
                newOuting.OutingType = OutingType.Arcade;
                break;

            case 3:
                newOuting.OutingType = OutingType.GoKarting;
                break;

            case 4:
                newOuting.OutingType = OutingType.Boating;
                break;

            default:
                Console.WriteLine($"Invalid Respose, {input} is not an option.");
                Console.ReadLine();
                break;
            }

            Console.WriteLine("\nHow many people attended this outing?");
            newOuting.TotalPeople = decimal.Parse(Console.ReadLine());

            Console.WriteLine("\nWhat Date did the outing occur? Please use the format YYYY/MM/DD");
            newOuting.Date = DateTime.Parse(Console.ReadLine()).Date;

            Console.WriteLine("\nWhat was the cost, per person, to attend? Please Do not Use a '$' ");
            newOuting.CostPerPerson = decimal.Parse(Console.ReadLine());

            newOuting.TotalCost = GetTotalCostForIndvOuting(newOuting.TotalPeople, newOuting.CostPerPerson);

            _outingRepo.AddOutingsToList(newOuting);
        }
Ejemplo n.º 4
0
        private void CastOutingToList()
        {
            Outings latestOuting = new Outings();

            Console.WriteLine("Which Event would you prefer?");
            latestOuting.OutingType = Console.ReadLine();

            Console.WriteLine("What date will your event take place?");
            latestOuting.OutingDate = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("How many people will be attending this event?");
            latestOuting.NumberOfPeople = int.Parse(Console.ReadLine());

            Console.WriteLine("Price per person");
            latestOuting.CostPerPerson = decimal.Parse(Console.ReadLine());

            Console.WriteLine("Price per event");
            latestOuting.EventCost = decimal.Parse(Console.ReadLine());

            _outingRepo.CastOutingsToList(latestOuting);
        }
 public void AddOutingToList(Outings outinglist)
 {
     _outingslist.Add(outinglist);
 }
Ejemplo 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)}");
                        }
                    }
                }
            }
        }
 public void AddOutingtoList(Outings outing)
 {
     _outingsList.Add(outing);
 }
Ejemplo n.º 8
0
 void CastOutingsToList(Outings latestOutings)
 {
     _outingsListing.Add(latestOutings);
 }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            ProgramUI _outingUI = new ProgramUI();

            DateTime date1 = new DateTime(2018, 4, 25);
            DateTime date2 = new DateTime(2018, 5, 25);
            DateTime date3 = new DateTime(2018, 6, 25);
            DateTime date4 = new DateTime(2018, 7, 25);

            Outings outing1 = new Outings("Golf", 4, date1, 100.00);
            Outings outing2 = new Outings("Bowling", 4, date2, 80.00);
            Outings outing3 = new Outings("Amusement Park", 4, date3, 200.00);
            Outings outing4 = new Outings("Concert", 4, date4, 400.00);

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

            bool displayMenu = true;

            while (displayMenu)
            {
                displayMenu = MainMenu();
            }

            bool MainMenu()
            {
                Console.Clear();
                Console.WriteLine("Welcome to the Komodo Outings Manager");
                Console.WriteLine("Choose an option:");
                Console.WriteLine("1) View All Outings");
                Console.WriteLine("2) Add New Outing");
                Console.WriteLine("3) View Total Cost");
                Console.WriteLine("4) View Cost by Event Type");
                Console.WriteLine("5) Exit");
                string result = Console.ReadLine();

                if (result == "1")
                {
                    _outingUI.PrintAllOutingssWithDetails();
                    return(true);
                }
                else if (result == "2")
                {
                    _outingUI.AddNewOuting();
                    return(true);
                }
                else if (result == "3")
                {
                    _outingUI.CostPerEvent();
                    return(true);
                }
                else if (result == "4")
                {
                    _outingUI.EventType();
                    return(true);
                }
                else if (result == "5")
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Ejemplo n.º 10
0
 public void AddOutingToList(Outings item)
 {
     _outings.Add(item);
 }
Ejemplo n.º 11
0
 public void AddOutingToList(Outings item)
 {
     _outingRepo.AddOutingToList(item);
 }
Ejemplo n.º 12
0
 public void addOuting(Outings outing)
 {
     OutingsList.Add(outing);
 }
 public void AddOutingsToList(Outings outing)
 {
     _listOfOutings.Add(outing);
 }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            OutingsRepository outingsRepo   = new OutingsRepository();
            List <Outings>    outingsList   = outingsRepo.GetList();
            Outings           royalPin      = new Outings(EventType.Bowling, 15, "6/23/2018", 23.00m, 345.0m);
            Outings           needToBreathe = new Outings(EventType.Concert, 6, "8/26/2018", 26.0m, 156.0m);
            Outings           parThree      = new Outings(EventType.Golf, 4, "7/31/2018", 15.0m, 60.0m);
            Outings           pebbleBrooke  = new Outings(EventType.Golf, 4, "6/30/2018", 25.0m, 100.0m);

            outingsRepo.AddToList(royalPin);
            outingsRepo.AddToList(needToBreathe);
            outingsRepo.AddToList(parThree);
            outingsRepo.AddToList(pebbleBrooke);

            string response = "0";

            while (response != "5")
            {
                Console.WriteLine($"What would you like to do?\n\n1. See all outings\n2. Add new outings to the list\n3. Determine total cost by outing type\n4. Determine current cost for all outstanding outings\n5. Exit Menu\n");
                response = Console.ReadLine();
                Console.Clear();

                if (response == "1")
                {
                    Console.Clear();
                    Console.WriteLine($"List of Outings\n\nOuting Type\tNumber Of People\tDate of Outing\t\tCost per Person\t\tTotal Cost");
                    foreach (Outings outing in outingsList)
                    {
                        Console.WriteLine($"{outing.Category}\t\t{outing.NumPpl} \t\t\t{outing.DateOfEvent}\t\t${outing.PerPersonCost}\t\t\t${outing.TotalEventCost}");
                    }
                    Console.WriteLine($"\nPress 'enter' to return to menu.");
                    Console.ReadLine();
                    Console.Clear();
                }

                if (response == "2")
                {
                    Outings outing = new Outings();
                    Console.WriteLine("Enter outing category: Golf = 1, Bowling = 2, Amusment Park = 3, Concert = 4, Other = 5");
                    string newCategory = Console.ReadLine();
                    int    categoryInt = Int32.Parse(newCategory);
                    if (categoryInt == 1)
                    {
                        outing.Category = EventType.Golf;
                    }
                    if (categoryInt == 2)
                    {
                        outing.Category = EventType.Bowling;
                    }
                    if (categoryInt == 3)
                    {
                        outing.Category = EventType.AmusmentPark;
                    }
                    if (categoryInt == 4)
                    {
                        outing.Category = EventType.Concert;
                    }
                    if (categoryInt == 5)
                    {
                        outing.Category = EventType.Other;
                    }

                    Console.WriteLine("How manny people attended the event?");
                    outing.NumPpl = Int32.Parse(Console.ReadLine());

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

                    Console.WriteLine("What was the cost per person?");
                    outing.PerPersonCost  = Decimal.Parse(Console.ReadLine());
                    outing.TotalEventCost = outing.PerPersonCost * outing.NumPpl;
                    outingsRepo.AddToList(outing);

                    Console.WriteLine($"\nPress 'enter' to return to menu.");
                    Console.ReadLine();
                    Console.Clear();
                }

                if (response == "3")
                {
                    outingsRepo.GetList();
                    OutingsRepository totalCostRepo = new OutingsRepository();
                    List <Outings>    listByType    = totalCostRepo.GetList();
                    List <decimal>    totalCostList = new List <decimal>();

                    Console.WriteLine("Enter desired outing type: Golf = 1, Bowling = 2, Amusment Park = 3, Concert = 4, Other = 5");
                    var desiredType = Int32.Parse(Console.ReadLine());

                    if (desiredType == 1)
                    {
                        foreach (Outings outing in outingsList)
                        {
                            if (outing.Category == EventType.Golf)
                            {
                                totalCostRepo.AddToList(outing);
                            }
                        }
                        foreach (Outings outing in listByType)
                        {
                            totalCostList.Add(outing.TotalEventCost);
                        }
                        decimal desiredCost = totalCostList.Sum();
                        Console.WriteLine("Total cost of desired outing = " + desiredCost);
                    }
                    if (desiredType == 2)
                    {
                        foreach (Outings outing in outingsList)
                        {
                            if (outing.Category == EventType.Bowling)
                            {
                                totalCostRepo.AddToList(outing);
                            }
                        }
                        foreach (Outings outing in listByType)
                        {
                            totalCostList.Add(outing.TotalEventCost);
                        }
                        decimal desiredCost = totalCostList.Sum();
                        Console.WriteLine("Total cost of desired outing = " + desiredCost);
                    }
                    if (desiredType == 3)
                    {
                        foreach (Outings outing in outingsList)
                        {
                            if (outing.Category == EventType.AmusmentPark)
                            {
                                totalCostRepo.AddToList(outing);
                            }
                        }
                        foreach (Outings outing in listByType)
                        {
                            totalCostList.Add(outing.TotalEventCost);
                        }
                        decimal desiredCost = totalCostList.Sum();
                        Console.WriteLine("Total cost of desired outing = " + desiredCost);
                    }
                    if (desiredType == 4)
                    {
                        foreach (Outings outing in outingsList)
                        {
                            if (outing.Category == EventType.Concert)
                            {
                                totalCostRepo.AddToList(outing);
                            }
                        }
                        foreach (Outings outing in listByType)
                        {
                            totalCostList.Add(outing.TotalEventCost);
                        }
                        decimal desiredCost = totalCostList.Sum();
                        Console.WriteLine("Total cost of desired outing = " + desiredCost);
                    }
                    if (desiredType == 5)
                    {
                        foreach (Outings outing in outingsList)
                        {
                            if (outing.Category == EventType.Other)
                            {
                                totalCostRepo.AddToList(outing);
                            }
                        }
                        foreach (Outings outing in listByType)
                        {
                            totalCostList.Add(outing.TotalEventCost);
                        }
                        decimal desiredCost = totalCostList.Sum();
                        Console.WriteLine("Total cost of desired outing = " + desiredCost);
                    }
                    Console.WriteLine($"\nPress 'enter' to return to menu.");
                    Console.ReadLine();
                    Console.Clear();
                }

                if (response == "4")
                //Determine cost for all outstanding outings
                {
                    decimal sum = 0;
                    foreach (Outings outing in outingsList)
                    {
                        sum += outing.TotalEventCost;
                    }
                    Console.WriteLine("The outstanding total cost is: $" + sum);
                    Console.ReadLine();
                    Console.Clear();
                }
            }
        }