コード例 #1
0
ファイル: Program.cs プロジェクト: shelbygrice/CSharpLibrary
        static void Main(string[] args)
        {
            Netflix parksAndRecreation = new Netflix();

            parksAndRecreation.Name         = "Parks and Recreation";
            parksAndRecreation.Rating       = 4.9m;
            parksAndRecreation.Genre        = "Comedy";
            parksAndRecreation.TotalMinutes = 22;


            parksAndRecreation.ShowMinutesLeft(22, 17);

            Netflix theOffice = new Netflix();

            theOffice.Name   = "The Office";
            theOffice.Rating = 5.0m;
            theOffice.Genre  = "Comedy";

            Netflix bobsBurgers = new Netflix();

            bobsBurgers.Name   = "Bob's Burgers";
            bobsBurgers.Rating = 3.7m;
            bobsBurgers.Genre  = "Cartoon Comedy";

            //parksAndRecreation.GetSuggestion();
            //theOffice.GetSuggestion();
            //bobsBurgers.GetSuggestion();

            //parksAndRecreation.ShowRunTime();
            //parksAndRecreation.WhoWatched("Shelby", "10;:30");


            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: dbpeetz/CSharpLibrary
        static void Main(string[] args)
        {
            Netflix blackMirror = new Netflix();

            blackMirror.Rating  = 3;
            blackMirror.Genre   = "Sci-Fi";
            blackMirror.Name    = "Black Mirror";
            blackMirror.Minutes = 48;


            Netflix strangerThings = new Netflix();

            strangerThings.Rating = 5;
            strangerThings.Genre  = "Sci-Fi";
            strangerThings.Name   = "Stranger Things";

            Netflix theMagicians = new Netflix();

            theMagicians.Rating = 5;
            theMagicians.Genre  = "Drama";
            theMagicians.Name   = "The Magicians";


            blackMirror.GetSuggestion();
            blackMirror.ShowRuntime();
            blackMirror.ShowWhoViewed("Karli", "10:30am");
            blackMirror.ShowMinutesLeft(30);


            strangerThings.GetSuggestion();
            theMagicians.GetSuggestion();



            Console.ReadLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: benmpeterson/CSharpLibrary
        static void Main(string[] args)
        {
            /*
             * BRONZE: Create a Netflix class with Properties of Name, Genre, Rating. Create three objects from that class.
             *
             * SILVER: Create a method called GetSuggestion() that returns different messages if
             * the Rating is over 4 to the console that says, "You should definitely watch
             * this show." The else message could be "You probably won't want to watch this show".
             *
             * GOLD: Create a list of objects based on the Netflix class.
             * Write a foreach loop that would iterate over the loop and print
             * the name, genre, and rating of each object.
             */

            Netflix movie1 = new Netflix();

            movie1.Genre        = "Comedy";
            movie1.Name         = "Ted";
            movie1.Rating       = 4.5f;
            movie1.TotalMinutes = 147;

            Netflix movie2 = new Netflix();

            movie2.Genre  = "Sci-Fi";
            movie2.Name   = "The Matrix";
            movie2.Rating = 5.0f;

            Netflix movie3 = new Netflix();

            movie3.Genre  = "Trash";
            movie3.Name   = "CHIPS";
            movie3.Rating = 0.0f;

            Console.WriteLine(movie1.Genre);
            Console.WriteLine(movie2.Genre);
            Console.WriteLine(movie3.Genre);
            Console.WriteLine();
            movie1.GetSuggestion();
            movie2.GetSuggestion();
            movie3.GetSuggestion();

            movie1.ShowRuntime();
            Console.WriteLine(movie1.ShowWhoView("Ben", "10"));
            //Console.WriteLine(movie1.details);

            Console.WriteLine(movie1.ShowHowManyMinutesLeft(32));

            string[] movieTitles = new string[] { movie1.Name, movie2.Name, movie3.Name };
            foreach (string movie in movieTitles)
            {
                Console.WriteLine(movie);
            }

            string[] movieGenre = new string[] { movie1.Genre, movie2.Genre, movie3.Genre };
            foreach (string movie in movieGenre)
            {
                Console.WriteLine(movie);
            }

            float[] movieRating = new float[] { movie1.Rating, movie2.Rating, movie3.Rating };
            foreach (int rating in movieRating)
            {
                Console.WriteLine(rating);
            }
            Console.ReadLine();
        }