コード例 #1
0
        private void AddOuting()
        {
            string type       = GetType();
            int    attendance = GetAttendance();
            string date       = GetDate();
            Outing newOuting  = new Outing(type, attendance, date);

            _outingRepo.AddOutingToList(newOuting);
        }
コード例 #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 ");
        }
コード例 #3
0
        private void AddNewOuting()
        {
            Outing newOuting = new Outing();

            Console.Clear();
            Console.WriteLine("To add a new outing, please answer the following prompts.\n" +
                              "What was the type of outing?");
            newOuting.OutingType = Console.ReadLine().ToLower();
            Console.WriteLine("How many people attended the outing?");
            newOuting.Attendance = int.Parse(Console.ReadLine());
            Console.WriteLine("What was the date of the outing? (MM/DD/YYYY)");
            newOuting.OutingDate = DateTime.Parse(Console.ReadLine());
            Console.WriteLine("What was the total cost for the outing?");
            newOuting.TotalCost     = decimal.Parse(Console.ReadLine());
            newOuting.CostPerPerson = newOuting.TotalCost / newOuting.Attendance;
            _outingRepo.AddOutingToList(newOuting);
        }
コード例 #4
0
        private void AddOuting()
        {
            Outing outing = new Outing();

            Console.WriteLine("Enter event type:");
            outing.EventType = Console.ReadLine();
            Console.WriteLine("Enter event date(dd/MM/yyyy)):");
            outing.EventDate = DateTime.Parse(Console.ReadLine());
            Console.WriteLine("Enter attendance numbers:");
            outing.EventAttendance = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter cost per person:");
            outing.EventCostPerPerson = decimal.Parse(Console.ReadLine());
            outing.EventCost          = outing.EventAttendance * outing.EventCostPerPerson;
            ReturnToMenu();

            _outingRepository.AddOutingToList(outing);
            Console.Clear();
        }
コード例 #5
0
        private void AddOuting()
        {
            Outing newOuting = new Outing();

            Console.WriteLine("Which event are you wanting to add: \n" +
                              "1. Golf\n" +
                              "2. Bowling\n" +
                              "3. Concert\n" +
                              "4. Park\n" +
                              "(Pick corresponding number)");
            var outingInput = int.Parse(Console.ReadLine());

            switch (outingInput)
            {
            case 1:
                newOuting.EventType = OutingType.Golf;
                break;

            case 2:
                newOuting.EventType = OutingType.Bowling;
                break;

            case 3:
                newOuting.EventType = OutingType.Concert;
                break;

            case 4:
                newOuting.EventType = OutingType.Park;
                break;

            default:
                break;
            }
            Console.WriteLine("How many people will be attending the event? (Please use number)");
            newOuting.Attendance = int.Parse(Console.ReadLine());
            Console.WriteLine("What date are you wanting the event to be on? (MM/DD/YYYY)");
            newOuting.Date = DateTime.Parse(Console.ReadLine());
            Console.WriteLine("What would the event cost per person?(no $ sign needed)");
            newOuting.CostPerPerson = decimal.Parse(Console.ReadLine());
            Console.WriteLine("What is the total cost for the event? (no $ sign needed)");
            newOuting.TotalCost = decimal.Parse(Console.ReadLine());

            _outingRepo.AddOutingToList(newOuting);
        }
コード例 #6
0
        private void AddOuting()
        {
            Console.WriteLine("Which outing did you participate in?");
            string eventType = Console.ReadLine();

            Console.WriteLine("How many employees attended the outing?");
            int numberOfPeople = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("What was the total cost of the outing?");
            double totalCost = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("What is the date of the outing. PLease write in thi format. mm/dd/yyyy");
            DateTime date = DateTime.Parse(Console.ReadLine());

            Outing newOuting = new Outing(eventType, numberOfPeople, totalCost, date);

            outingRepo.AddOutingToList(newOuting);
            Console.Clear();
            InitialPrompt();
        }
コード例 #7
0
        public void AddNewOuting()
        {
            Outing newOuting = new Outing();

            Console.WriteLine("What is the Type of Outing? (1.Concert, 2.Movie, 3.Ballgame)");
            newOuting.TypeOfOuting = (OutingType)int.Parse(Console.ReadLine());

            Console.WriteLine("How many people attended?");
            newOuting.AtendeeAmount = int.Parse(Console.ReadLine());

            Console.WriteLine("What was the date of the outing?");
            newOuting.OutingDate = Console.ReadLine();

            Console.WriteLine("How much were each of the attendees charged?");
            newOuting.AtendeeCost = decimal.Parse(Console.ReadLine());

            Console.WriteLine("How much did the event cost?");
            newOuting.OutingCost = decimal.Parse(Console.ReadLine());

            _outingRepo.AddOutingToList(newOuting);
        }
コード例 #8
0
        private void AddOutings()
        {
            OutingContent newOuting = new OutingContent();

            Console.WriteLine("What type of outing is it?");
            newOuting.OutingType = Console.ReadLine();

            Console.WriteLine("How many people attended?");
            newOuting.NumOfPeople = int.Parse(Console.ReadLine());

            Console.WriteLine("What was the date?");
            newOuting.Date = Console.ReadLine();

            Console.WriteLine("Total cost per person for the event?");
            newOuting.TotalPerPerson = decimal.Parse(Console.ReadLine());

            Console.WriteLine("Total cost for the event?");
            newOuting.TotalForEvent = decimal.Parse(Console.ReadLine());

            _outingRepo.AddOutingToList(newOuting);
        }
コード例 #9
0
        private void AddOuting()
        {
            Console.Clear();
            Console.WriteLine("Enter the number for the outing you want to create: (Golf-1/Bowling-2/Amusementpark-3/Concert-4)");
            var typeofevent = int.Parse(Console.ReadLine());

            Console.WriteLine("How many people will attend the outing?");
            var attendance = int.Parse(Console.ReadLine());

            Console.WriteLine("On what date is the event taking place? (YYYY, MM, DD)");
            var eventdate = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("What is the price per person? (0.00)");
            var perpersoncost = decimal.Parse(Console.ReadLine());

            Console.WriteLine("What is the total cost of the event? (0.00)");
            var    eventcost = decimal.Parse(Console.ReadLine());
            Outing outing    = new Outing((EventType)typeofevent, attendance, eventdate, perpersoncost, eventcost); //Adds value to the outing properties

            _outingRepo.AddOutingToList(outing);                                                                    //Adds outing to List<Outing>
        }
コード例 #10
0
        private void AddOuting()
        {
            Outing newOuting = new Outing();

            Console.WriteLine("Enter the type of event (golf, bowling, amusement park, or concert):");
            string input = Console.ReadLine();

            switch (input)
            {
            case "golf":
                newOuting.TypeOfEvent = EventType.Golf;
                break;

            case "bowling":
                newOuting.TypeOfEvent = EventType.Bowling;
                break;

            case "amusement park":
                newOuting.TypeOfEvent = EventType.AmusementPark;
                break;

            case "concert":
                newOuting.TypeOfEvent = EventType.Concert;
                break;
            }


            Console.WriteLine("Enter number of people in attendance:");
            newOuting.NumberOfPeople = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter date of event:");
            newOuting.DateOfEvent = Console.ReadLine();

            Console.WriteLine("Enter the cost per person:");
            newOuting.CostPerPerson = decimal.Parse(Console.ReadLine());

            newOuting.CostOfEvent = newOuting.NumberOfPeople * newOuting.CostPerPerson;

            _outingRepo.AddOutingToList(newOuting);
        }
コード例 #11
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)}");
                        }
                    }
                }
            }
        }
コード例 #12
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;
                }
            }
        }
コード例 #13
0
 public void AddOutingToList(Outings item)
 {
     _outingRepo.AddOutingToList(item);
 }
コード例 #14
0
        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;
                }
            }
        }