static public bool ListCars() { //Console.Clear(); for (int i = 0; i < carlot.Count; i++) { Console.WriteLine($"{i + 1}. {carlot[i]}"); } Console.WriteLine($"{carlot.Count + 1} Add a Vechile"); Console.WriteLine($"{carlot.Count + 2} Quit "); Console.Write("Select the car would you like to buy? "); int choice = Int32.Parse(Console.ReadLine()); if (choice > 0 && choice < carlot.Count + 1) { Console.WriteLine($"\nYour choice was\n{ carlot[choice]}"); Console.Write($"\nAre you sure you would like to buy this car? Please enter y or n: "); string buy = Console.ReadLine(); if (buy == "y") { Console.WriteLine("\nThe finanical department will be with you shortly. "); CarLot.BuyCar(choice, carlot); } else { Console.Clear(); } return(true); } else if (choice == carlot.Count + 1) { CarLot.UserAddedCar(); return(true); } else if (choice == carlot.Count + 2) { Console.WriteLine("Thank you! Have a wonderful great day!"); return(false); } else { return(false); } }
static public bool ListCars() { //Console.Clear(); for (int i = 0; i < carlot.Count; i++) { Console.WriteLine($"{i + 1}. {carlot[i]}"); } Console.WriteLine($"{carlot.Count + 1} Add a car"); Console.WriteLine($"{carlot.Count + 2} quit "); Console.WriteLine("which car would you like to buy?"); int choice = Int32.Parse(Console.ReadLine()); if (choice > 0 && choice < carlot.Count + 1) { Console.WriteLine($"you selected\n{ carlot[choice]}"); Console.WriteLine($"would you like to buy this car? y/n"); string buy = Console.ReadLine(); if (buy == "y") { Console.WriteLine("Execellent! our finance department will be in touch shortly. "); CarLot.BuyCar(choice, carlot); } else { Console.Clear(); } return(true); } else if (choice == carlot.Count + 1) { CarLot.UserAddedCar(); return(true); } else if (choice == carlot.Count + 2) { Console.WriteLine("Have a great day!"); return(false); } else { return(false); } }