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); }
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(); }
public void CreateOuting() { Console.Clear(); Console.Write("What type of outing? "); EventType type = 0; switch (Console.ReadLine().ToLower()) { case "golf": type = EventType.Golf; break; case "concert": type = EventType.Concert; break; case "bowling": type = EventType.Bowling; break; case "amusement park": type = EventType.AmusementPark; break; } Console.Write("How much per person? "); decimal cost = Decimal.Parse(Console.ReadLine()); Console.Write("How many people? "); int numP = int.Parse(Console.ReadLine()); Console.Write("When (MM/dd/yyyy)? "); DateTime dt = DateTime.Parse(Console.ReadLine()); Outing outing = new Outing(type, numP, dt, cost); repo.AddOuting(outing); }
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; } } }
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; } } }