public void PrintAllOutingssWithDetails() { Console.Clear(); foreach (var item in _outingRepo.GetList()) { Console.WriteLine(item); } Console.ReadLine(); }
private void DisplayList() { tempList = outingRepo.GetList(); foreach (OutingClass item in tempList) { Console.WriteLine(item); } Console.ReadLine(); Console.Clear(); InitialPrompt(); }
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"); }
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"); }
private void UIDisplay() { Console.Clear(); _outings = outingRepo.GetList(); if (_outings.Count == 0) { Console.Clear(); Console.WriteLine("List is Empty, Please Add an Outing(s)"); Console.ReadKey(); InitialPrompt(); } else { foreach (Outing outing in _outings) { Console.WriteLine(outing); } Console.ReadKey(); InitialPrompt(); } }
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 Run() { _outings = _outingRepo.GetList(); 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: _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; case 5: break; default: _console.WriteLine("Please enter a correct value."); break; } _console.WriteLine("Press any key to continue ..."); _console.ReadKey(); } }
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; } } }
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; } } }
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); } } } }