public static void Main(string[] args) { AddToCatelog addToCatelog = new AddToCatelog(); string[] Arr = new string[] { "add", "list", "quit" }; Console.WriteLine("======Welcome to Ginatech Auto Shop===="); bool correct = false; int i = 1; while (!correct) { i++; Console.WriteLine("Enter one of the options below \n\n.add \n\n.List\n\n.quit"); string input = Console.ReadLine().ToLower(); if (input.Equals(Arr [0])) { addToCatelog.listMethod(); } if (input.Equals(Arr [1])) { Console.WriteLine("There are currently no cars in the catalog."); } if (input.Equals(Arr [2])) { break; } else { Console.WriteLine("Sorry, but " + input + " is not a valid command. Please try again. "); continue; } } }
public void listMethod() { for (int i = 1; i <= Catelog.Length - 1; i++) { Console.WriteLine("Enter the make"); Make = Console.ReadLine(); Console.WriteLine("Enter the model"); Model = Console.ReadLine(); Console.WriteLine("Enter the Year"); Year = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter price"); SalePrice = Convert.ToDecimal(Console.ReadLine()); AddToCatelog newcar = new AddToCatelog(); cars.Add(newcar); Console.WriteLine("Enter: [QUIT] to quit or [LIST] to view all cars or [ADD] to contiue"); string output = Console.ReadLine(); string check = output.ToLower(); } }