示例#1
0
        //This code is pretty bad and I'm not proud of it, but it is working and I don't have the spare time to refactor this into something better.
        //TODO: Put SurveyToppings() out of it's misery.
        private List <Topping> SurveyToppings(ToppingList toppingList)
        {
            Console.WriteLine("Please rate the following toppings from 1 to 5, 1 being least liked and 5 being most liked. For any toppings you cannot eat, use 0.");
            int            likeness = 0;
            List <Topping> toppings = new List <Topping>(toppingList.Toppings.Length);

            for (int i = 0; i < toppingList.Toppings.Length; i++)
            {
                Console.WriteLine(toppingList.Toppings[i] + ": ");
                likeness = Int32.Parse(Console.ReadLine());
                Topping toAdd = new Topping(
                    toppingList.Toppings[i],
                    likeness,
                    true,
                    true
                    );
                toppings.Add(toAdd);
            }
            return(toppings);
        }
示例#2
0
        public void CreatePerson()
        {
            Console.WriteLine("Please enter the following information:");
            Console.WriteLine("Username: "******"finish" || username.ToLower() == "quit")
            {
                Console.WriteLine("Sorry, that is an invalid username. Press any key to try again.");
                Console.ReadKey();
                CreatePerson();
            }
            Console.WriteLine("Full name: ");
            var name = Console.ReadLine();

            ToppingList    toppingList = new ToppingList();
            List <Topping> toppings    = SurveyToppings(toppingList);

            Person person = new Person(name, username, toppings);

            SavePerson(person);
        }