示例#1
0
        static void OnlineProductSample()
        {
            OnlineProduct myOnlineProduct = new OnlineProduct("Toybook", "Picture of a a toy book");

            Console.WriteLine(myOnlineProduct.Name);
            Console.WriteLine(myOnlineProduct.Price);
            Console.WriteLine(myOnlineProduct.Picture);
            Console.WriteLine(myOnlineProduct.Dimension);


            myOnlineProduct.Buy(true);
        }
示例#2
0
        static void MyOnlineProductResults()
        {
            // Created and object instance of  online product called myOnlineProduct

            OnlineProduct myOnlineProduct = new OnlineProduct();

            //my first online product is a Ball
            myOnlineProduct.Name = "Ball";
            Console.WriteLine(myOnlineProduct.Name);
            myOnlineProduct.Buy();
            myOnlineProduct.Return();
            myOnlineProduct.Price = "5.0 Euro";
            Console.WriteLine(myOnlineProduct.Price);
            myOnlineProduct.AddToWatchList();
            myOnlineProduct.Picture = "Picture of a Basketball";
            Console.WriteLine(myOnlineProduct.Picture);
            myOnlineProduct.Description = "This is a Basketball";
            myOnlineProduct.Dimension   = "Radius 15 inches";
            Console.WriteLine(myOnlineProduct.Description);
            Console.WriteLine(myOnlineProduct.Dimension);

            OnlineProduct mySecondOnlineProduct = new OnlineProduct();

            //my second online product is a Book
            mySecondOnlineProduct.Name = "Book";
            Console.WriteLine(mySecondOnlineProduct.Name);
            mySecondOnlineProduct.AddToWatchList();
            mySecondOnlineProduct.Price = "20 Dollars";
            Console.WriteLine(mySecondOnlineProduct.Price);
            mySecondOnlineProduct.Description = "This is a Cookbook";
            Console.WriteLine(mySecondOnlineProduct.Description);
            mySecondOnlineProduct.Dimension = "8.5 X 11 inches";
            Console.WriteLine(mySecondOnlineProduct.Dimension);

            OnlineProduct myThirdOnlineProduct = new OnlineProduct();

            //my third online product is a toy
            myThirdOnlineProduct.Name = "Toy";
            Console.WriteLine(myThirdOnlineProduct.Name);
            myThirdOnlineProduct.Like();
            myThirdOnlineProduct.PrepareForShipping();
            myThirdOnlineProduct.Price = "$10";
            Console.WriteLine(myThirdOnlineProduct.Price);
            myThirdOnlineProduct.Description = "This is a Toy";
            Console.WriteLine(myThirdOnlineProduct.Description);
            myThirdOnlineProduct.Dimension = "25 inch x 13 feet";
            Console.WriteLine(myThirdOnlineProduct.Dimension);
            myThirdOnlineProduct.Buy();
            myThirdOnlineProduct.Return();
        }