コード例 #1
0
        static void Main(string[] args)
        {
            // TODO: Declare and initialize a CD and a DVD object.
            List <string> tracks = new List <string>();

            tracks.Add("Track 1");
            tracks.Add("Track 2");
            tracks.Add("Track 3");
            tracks.Add("Track 4");
            tracks.Add("Track 5");

            CD myCd = new CD(500, "Luke Combs", "country", tracks);

            myCd.SpinDisc();
            myCd.LoadData();
            myCd.ReadData();
            myCd.StoreData();
            myCd.WriteData();
            myCd.DisplayMenu();
            myCd.DisplayData(tracks);



            List <string> chapters = new List <string>();

            chapters.Add("Chp 1");
            chapters.Add("Chp 2");
            chapters.Add("Chp 3");
            chapters.Add("Chp 4");

            DVD myDvd = new DVD(200, "Extraction", "Action", chapters);

            myDvd.SpinDisc();
            myDvd.LoadData();
            myDvd.ReadData();
            myDvd.StoreData();
            myDvd.WriteData();
            myDvd.DisplayMenu();
            myDvd.DisplayData(chapters);

            // TODO: Call each CD and DVD method to verify that they work as expected.
        }
コード例 #2
0
        static void Main(string[] args)
        {
            // TODO: Declare and initialize a CD and a DVD object.
            CD  backInBlack = new CD("Back in Black", 2, "ACDC albumn", "Rock");
            DVD lOTR        = new DVD("Lord of the Rings", 12, "Director's cut", "Fantasy");

            // TODO: Call each CD and DVD method to verify that they work as expected.

            backInBlack.ReadDisc();
            backInBlack.ReportInfo();
            backInBlack.SpinDisc();
            backInBlack.StoreData();
            backInBlack.WriteDisc();

            lOTR.ReadDisc();
            lOTR.ReportInfo();
            lOTR.SpinDisc();
            lOTR.StoreData();
            lOTR.WriteDisc();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            // TODO: Declare and initialize a CD and a DVD object.
            CD  testCD  = new CD("testCD");
            DVD testDVD = new DVD("testDVD");

            // TODO: Call each CD and DVD method to verify that they work as expected.

            testCD.DiskSpin();
            testCD.WriteDisk("WE are we are");
            //testCD.ReadDisc();
            testCD.LaserSwitch(true);
            //testCD.ReadDisc();

            testDVD.DiskSpin();
            testDVD.WriteDisk("WE are we are DVDS");
            //testDVD.ReadDisc();
            testDVD.LaserSwitch(true);
            //testDVD.ReadDisc();
        }
コード例 #4
0
        static void Main(string[] args)

        {
            // TODO: Declare and initialize a CD and a DVD object.

            CD Cd1 = new CD("First CD");

            DVD Dvd1 = new DVD("First DVD");

            // TODO: Call each CD and DVD method to verify that they work as expected.

            Cd1.SpinDisc();

            Dvd1.SpinDisc();



            Console.WriteLine("\n" + Cd1.ToString());

            Console.WriteLine(Dvd1.ToString());
        }
コード例 #5
0
        static void Main(string[] args)
        {
            // TODO: Declare and initialize a CD and a DVD object.

            IOpticalDisc myCD = new CD(256, 25, true);

            myCD.SpinDisc();

            myCD.ReadData();

            myCD.WriteData(25);

            myCD.ReadData();

            IOpticalDisc myDVD = new DVD(256, 256, false);

            myDVD.SpinDisc();
            myDVD.ReadData();

            // TODO: Call each CD and DVD method to verify that they work as expected.
        }
コード例 #6
0
        static void Main(string[] args)
        {
            CD  cd  = new CD("Test CD", 100, false);
            DVD dvd = new DVD("Test DVD", 4000, true);

            cd.SpinDisc();
            dvd.SpinDisc();

            cd.ReadDisc();
            dvd.ReadDisc();

            List <byte> testBytes = new List <byte>();

            testBytes.Add(0);
            testBytes.Add(1);
            testBytes.Add(2);
            testBytes.Add(3);

            Console.WriteLine(cd.WriteData(testBytes, 4));
            Console.WriteLine(dvd.WriteData(testBytes, 4));
            Console.WriteLine(dvd.WriteData(testBytes, 8000));
        }
コード例 #7
0
        static void Main(string[] args)
        {
            // TODO: Declare and initialize a CD and a DVD object.
            List <string> filesCd = new List <string> {
                "mp3", "pdf", "doc", "img"
            };
            CD cd = new CD(4, 2, filesCd, true, false);

            List <string> filesDvd = new List <string> {
                "mp4"
            };
            DVD dvd = new DVD(32, 12, filesDvd, false, false);

            // TODO: Call each CD and DVD method to verify that they work as expected.
            cd.burn(cd);
            cd.run();
            Console.WriteLine(cd.IsRunning);
            cd.spin();
            cd.stop();
            Console.WriteLine(cd.IsRunning);

            try
            {
                dvd.burn(dvd);
            }
            catch (Exception)
            {
                Console.WriteLine("This DVD isn't burnable.");
            }

            dvd.run();
            Console.WriteLine(dvd.IsRunning);
            dvd.spin();
            dvd.stop();
            Console.WriteLine(dvd.IsRunning);
        }
コード例 #8
0
        static void Main(string[] args)
        {
            // TODO: Declare and initialize a CD and a DVD object.

            // TODO: Call each CD and DVD method to verify that they work as expected.

            CD cd = new CD("Johnny Cash", "CD");

            cd.SpinDisk();
            ((IDisk)cd).ReadableByLaser();
            ((IDisk)cd).DiskSize();
            cd.DataWrittenByLaser();
            ((IDisk)cd).DiskMaterial();
            cd.StoreData();

            DVD dvd = new DVD("Shrek", "DVD", 8);

            dvd.SpinDisk();
            ((IDisk)dvd).ReadableByLaser();
            ((IDisk)dvd).DiskSize();
            dvd.DataWrittenByLaser();
            ((IDisk)dvd).DiskMaterial();
            dvd.StoreData();
        }
コード例 #9
0
        static void Main(string[] args)
        {
            // TODO: Declare and initialize a CD and a DVD object.
            CD  myCD  = new CD("MP3", "Little Lights", "Kate Rusby songs");
            DVD myDVD = new DVD("VCD", "The Princess Bride", "Princess bride video chapters");

            myCD.ReportInfo();
            myCD.spinDisc();
            myCD.insertDisc();
            myCD.ejectDisc();
            myCD.storeData();
            myCD.writeData();
            myCD.readData();

            myDVD.ReportInfo();
            myDVD.spinDisc();
            myDVD.insertDisc();
            myDVD.ejectDisc();
            myDVD.storeData();
            myDVD.writeData();
            myDVD.readData();

            // TODO: Call each CD and DVD method to verify that they work as expected.
        }
コード例 #10
0
        static void Main(string[] args)
        {
            // DECLARING AND INITIALIZING OBJECTS TO WORK WITH
            CD testCD = new CD("Foo Fighters", "The Colour and the Shape", 700, new List <string> {
                "Monkey Wrench", "Everlong", "My Hero"
            }, "CD");
            DVD testDVD = new DVD("Austin Powers: Goldmember", 4700, new List <string> {
                "Movie", "Unrated Version", "Special Features"
            }, "DVD");
            CD blankCD = new CD(700);

            //SPINDISC METHOD SIMPLY TELLS YOU HOW FAST EACH TYPE OF DISC SPINS
            testCD.SpinDisc();
            testDVD.SpinDisc();

            Console.WriteLine("\n*****\n");

            //REPORTDATA METHOD CAN BE CALLED DIRECTLY, BUT IT'S ALSO CALLED BY THE READDATA METHOD BELOW BECAUSE THAT MAKES MORE SENSE
            testCD.ReportData();
            testDVD.ReportData();
            blankCD.ReportData();

            Console.WriteLine("*****\n");

            //WRITEDATA METHOD REQUIRES USER INPUT
            testCD.WriteData();
            testDVD.WriteData();
            blankCD.WriteData();
            blankCD.ReportData();

            Console.WriteLine("\n*****");

            //THE LASER READS THE DATA ON THE DISC AND REPORTS WHAT IT FINDS
            testCD.ReadData();
            testDVD.ReadData();
        }
コード例 #11
0
        static void Main(string[] args)
        {
            // TODO: Declare and initialize a CD and a DVD object.
            DVD d = new DVD(new Dictionary <string, int>());

            d.Contant.Add("music1", 100);
            d.Contant.Add("music2", 100);
            d.Contant.Add("music3", 200);

            DVD d1 = new DVD("My Movie Collections-", 1700, new Dictionary <string, int>(), "Read/Write"); // dvd instance create

            d1.Contant.Add("I Still know what you did Last Summer", 100);
            d1.Contant.Add("Paranormal", 100);
            d1.Contant.Add("Dance With Me", 100);


            CD c = new CD("Music Audio-Bethoven", 520, new Dictionary <string, int>(), "ReadOnly"); // cd instance create

            c.Contant.Add("music1", 100);
            c.Contant.Add("music2", 100);
            c.Contant.Add("music3", 200);

            // TODO: Call each CD and DVD method to verify that they work as expected.
            while (true)
            {
                Console.WriteLine("\nSelect choice Number: \n");

                int displaySelectedChoice = displayChoice();
                if (displaySelectedChoice == 1)
                {
                    // DVD readdata() AND WriteData() interface call
                    d1.ReadData(d1.Contant, d1.DiscType, d1.Name, d1.Capacity);
                }
                else if (displaySelectedChoice == 2)
                {
                    d1.WriteData(d1.Contant, d1.Capacity);
                    Console.WriteLine("Your DVD Burn complete. Press 3 to look into the content.");
                }
                // d1.ReadData(d1.Contant, d1.DiscType, d1.Name, d1.Capacity);


                // CD Readdata() AND WriteData() interface call

                else if (displaySelectedChoice == 3)
                {
                    c.ReadData(c.Contant, c.DiscType, c.Name, c.Capacity);
                }
                else if (displaySelectedChoice == 4)
                {
                    d1.SpinDisc(d1.Name);
                }
                else if (displaySelectedChoice == 5)
                {
                    c.SpinDisc(c.Name);
                }
                else if (displaySelectedChoice == 6)
                {
                    Console.Write("Do you want to EXIT from quiz? (Yes/No): ");
                    string yesOrNO = Console.ReadLine();
                    if (yesOrNO.ToLower() == "yes")
                    {
                        Console.WriteLine("--------------------GOODBYE----------------------------------");

                        break;
                    }
                }



                //c.ReadData(c.Contant, c.DiscType, c.Name, c.Capacity);
            }
        }
コード例 #12
0
        // TODO: Implement your custom interface.

        // TODO: Determine which fields, methods, and constructors can be extended from the base class and which ones
        //  need to be declared separately.
        public void SpinDisc(CD x)
        {
            Console.WriteLine($"This CD is spinning at {x.DiscSPeed} rpm.");
        }