示例#1
0
        static void Main(string[] args)
        {
            // Sharpie Set

            // Reuse your Sharpie class
            // Create SharpieSet class
            // it contains a list of Sharpie
            // Add method CountUsable() -> sharpie is usable if it has ink in it
            //    Add method RemoveTrash() -> removes all unusable sharpies

            SharpieSet sharpieSet = new SharpieSet(new List <Sharpie>());

            var sharpie1 = new Sharpie(1, "blue", 100, 100, true, "sharpie1");
            var sharpie2 = new Sharpie(1, "green", 100, 100, true, "sharpie2");
            var sharpie3 = new Sharpie(1, "red", 100, 100, true, "sharpie3");
            var sharpie4 = new Sharpie(1, "yellow", 100, 100, true, "sharpie4");


            sharpieSet.sharpieList.Add(sharpie1);
            sharpieSet.sharpieList.Add(sharpie2);
            sharpieSet.sharpieList.Add(sharpie3);
            sharpieSet.sharpieList.Add(sharpie4);

            sharpie1.Use();
            sharpie3.Use();
            sharpieSet.CountUsable(sharpieSet.sharpieList);
            sharpieSet.RemoveTrash(sharpieSet.sharpieList);
            sharpieSet.PrintOutSharpieList(sharpieSet.sharpieList);
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            SharpieSet dogsOfSharpieSet = new SharpieSet();

            dogsOfSharpieSet.sharpies.Add(new Sharpie(2.4f));
            dogsOfSharpieSet.sharpies.Add(new Sharpie("yellow", 1.2f));
            dogsOfSharpieSet.sharpies.Add(new Sharpie("black"));
            Console.WriteLine(dogsOfSharpieSet.sharpies.Count);

            Console.WriteLine(dogsOfSharpieSet.CountUsable());
            Console.WriteLine(dogsOfSharpieSet.RemoveTrash());
            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            Sharpie red  = new Sharpie("red", 0.3f);
            Sharpie blue = new Sharpie("blue", 0.2f);

            SharpieSet mySharpies = new SharpieSet();

            mySharpies.Add(red);
            mySharpies.Add(blue);
            mySharpies.CountUsable();
            for (int i = 0; i < 100; i++)
            {
                red.Use();
            }
            mySharpies.CountUsable();
            mySharpies.RemoveTrash();
        }
示例#4
0
        static void Main(string[] args)
        {
            var sharpieOne   = new Sharpie("blue", 1);
            var sharpieTwo   = new Sharpie("red", 0.5);
            var sharpieThree = new Sharpie("purple", 1);
            var setOne       = new SharpieSet();

            setOne.Add(sharpieOne);
            setOne.Add(sharpieTwo);
            setOne.Add(sharpieThree);

            for (int i = 0; i < 100; i++)
            {
                sharpieOne.Use();
            }

            Console.WriteLine($"Number of usable sharpies: {setOne.CountUsable()}");
            setOne.RemoveTrash();
        }
示例#5
0
        static void Main(string[] args)
        {
            var sharpieTest = new SharpieSet();

            sharpieTest.Add(new Sharpie("yellow", 100));
            sharpieTest.Add(new Sharpie("blue", 100));
            sharpieTest.Add(new Sharpie("black", 100));
            sharpieTest.Add(new Sharpie("green", 100));

            foreach (var sharpie in sharpieTest.Sharpies)
            {
                for (int i = 0; i < 100; i++)
                {
                    sharpie.Use();
                }
            }

            Console.WriteLine(sharpieTest.CountUsable());
            sharpieTest.RemoveTrash();
            Console.WriteLine(sharpieTest.CountUsable());
        }
示例#6
0
        static void Main(string[] args)
        {
            SharpieSet sharpieList = new SharpieSet();

            sharpieList.Add(new Sharpie("black", 100, 100));
            sharpieList.Add(new Sharpie("black", 100, 50));
            sharpieList.Add(new Sharpie("black", 100, 0));
            sharpieList.Add(new Sharpie("black", 100, 100));
            sharpieList.Add(new Sharpie("black", 100, 200));
            sharpieList.Add(new Sharpie("black", 100, 0));
            sharpieList.Add(new Sharpie("black", 100, 40));
            sharpieList.Add(new Sharpie("black", 100, 0));
            sharpieList.Add(new Sharpie("black", 100, 0));

            Console.WriteLine(sharpieList.CountUsable());
            sharpieList.Removetrash();

            sharpieList.PrintOut();

            Console.ReadLine();
        }
示例#7
0
        // Sharpie Set
        // Reuse your Sharpie class
        // Create SharpieSet class
        // it contains a list of Sharpie
        // Add method CountUsable() -> sharpie is usable if it has ink in it
        // Add method RemoveTrash() -> removes all unusable sharpies

        static void Main(string[] args)
        {
            var first  = new Sharpie("Black", 6);
            var second = new Sharpie("White", 7);

            first.Use();
            second.Use();


            //Console.WriteLine(second.InkAmount);

            var newlist = new SharpieSet();

            //newlist.Sharpies.Add(new Sharpie("White", 4));
            newlist.Sharpies.Add(first);
            newlist.Sharpies.Add(second);


            Console.WriteLine(newlist.CountUsable());
            //Console.WriteLine(newlist.RemoveTrash());
            Console.ReadLine();
        }
示例#8
0
        static void Main(string[] args)
        {
            /*Sharpie Set
             * Reuse your Sharpie class
             * Create SharpieSet class
             * it contains a list of Sharpie
             * Add method CountUsable() -> sharpie is usable if it has ink in it
             * Add method RemoveTrash() -> removes all unusable sharpies*/

            SharpieSet.AddSharpieToList(new Sharpie("pink", 2));
            SharpieSet.AddSharpieToList(new Sharpie("red", 2));
            SharpieSet.AddSharpieToList(new Sharpie("blue", 2));
            SharpieSet.AddSharpieToList(new Sharpie("yellow", 2, 0));

            Console.WriteLine($"You have {SharpieSet.Sharpies.Count} sharpies.");

            SharpieSet.CountUsable();

            SharpieSet.RemoveTrash();

            Console.ReadLine();
        }