示例#1
0
        public static Person CreateUser()
        {
            Console.WriteLine("Please enter the following information:");
            Console.WriteLine("Full name: ");
            var name = Console.ReadLine();

            Console.WriteLine("Email: ");
            var email = Console.ReadLine();

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

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

            return(person);
        }
示例#2
0
        public static List <ITopping> 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 <ITopping> toppings = new List <ITopping>(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);
        }