コード例 #1
0
        static void Main(string[] args)
        {
            Photo       photo       = new Photo(8, 10);
            MattedPhoto mattedphoto = new MattedPhoto(8, 10, "black");
            FramedPhoto framedPhoto = new FramedPhoto(8, 10, "wood", "modern");

            WriteLine(photo.ToString());
            WriteLine(mattedphoto.ToString());
            WriteLine(framedPhoto.ToString());
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: pmbanda/C-Sharp-Projects
        static void Main(string[] args)
        {
            //demonstrate the methods for photo related classes
            Photo photo  = new Photo(8, 10);
            Photo photo1 = new Photo(10, 12);

            //display objects
            WriteLine(photo);
            WriteLine();
            WriteLine(photo1);

            WriteLine();

            //demonstrate the methods for matted photo related classes
            MattedPhoto mPhoto1 = new MattedPhoto(8, 10, "Red");
            MattedPhoto mPhoto2 = new MattedPhoto(10, 12, "Green");
            MattedPhoto mPhoto3 = new MattedPhoto(15, 11, "Blue");

            //display objects
            WriteLine(mPhoto1);
            WriteLine();
            WriteLine(mPhoto2);
            WriteLine();
            WriteLine(mPhoto3);

            WriteLine();

            //demonstrate the methods for framed photo related classes
            FramedPhoto fPhoto1 = new FramedPhoto(8, 10, "Silver", "Modern");
            FramedPhoto fPhoto2 = new FramedPhoto(10, 12, "Gold", "Old");
            FramedPhoto fPhoto3 = new FramedPhoto(15, 11, "Bronze", "Classic");

            //display objects
            WriteLine(fPhoto1);
            WriteLine();
            WriteLine(fPhoto2);
            WriteLine();
            WriteLine(fPhoto3);

            ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Photos, const $3.99 8inch by 10inch, const $5.99 for 10inch by 12inch, const $9.99 as default: " + Environment.NewLine);
            Photo photo = new Photo(8, 10);

            DisplayPhoto(photo);
            photo.Length = 12;
            photo.Width  = 10;
            DisplayPhoto(photo);
            photo.Length = 14;
            photo.Width  = 12;
            DisplayPhoto(photo);
            Console.WriteLine(Environment.NewLine + "MattedPhotos, const $3.99 8inch by 10inch plus 10, const $5.99 for 10inch by 12inch plus ten, const $9.99 as default plus 25: " + Environment.NewLine);
            MattedPhoto mtphoto = new MattedPhoto(8, 10, "Blue");

            DisplayMattedPhoto(mtphoto);
            mtphoto.Length = 12;
            mtphoto.Width  = 10;
            mtphoto.Color  = "Green";
            DisplayMattedPhoto(mtphoto);
            mtphoto.Length = 14;
            mtphoto.Width  = 12;
            mtphoto.Color  = "Brown";
            DisplayMattedPhoto(mtphoto);
            Console.WriteLine(Environment.NewLine + "FramedPhotos, const $3.99 8inch by 10inch plus 25, const $5.99 for 10inch by 12inch plus 25, const $9.99 as default plus 25: " + Environment.NewLine);
            FramedPhoto fmphoto = new FramedPhoto(8, 10, "Fabric", "Old");

            DisplayFramedPhoto(fmphoto);
            fmphoto.Length   = 12;
            fmphoto.Width    = 10;
            fmphoto.Material = "Glass";
            fmphoto.Style    = "Modern";
            DisplayFramedPhoto(fmphoto);
            fmphoto.Length   = 14;
            fmphoto.Width    = 12;
            fmphoto.Material = "Steel";
            fmphoto.Style    = "Industrial";
            DisplayFramedPhoto(fmphoto);
        }
コード例 #4
0
ファイル: PhotoDemo.cs プロジェクト: CodeMaineAC/PhotoDemo
        static void Main(string[] args)
        {
            Photo photo1 = new Photo();

            photo1.Width  = 8;
            photo1.Height = 10;

            Console.WriteLine(photo1.ToString());

            MattedPhoto mphoto1 = new MattedPhoto();

            mphoto1.Width  = 10;
            mphoto1.Height = 12;
            mphoto1.Color  = "Blue";
            Console.WriteLine(mphoto1.ToString());

            FramedPhoto fphoto = new FramedPhoto();

            fphoto.Width    = 3;
            fphoto.Height   = 4;
            fphoto.Style    = "Modern";
            fphoto.Material = "Titanium";
            Console.WriteLine(fphoto.ToString());
        }
コード例 #5
0
 private static void DisplayFramedPhoto(FramedPhoto photo)
 {
     Console.WriteLine("\tType: {0}, ToString(): {1}, Length: {2}, Width: {3}, Material: {4}, Style: {5}, Price: {6}", photo.GetType(), photo.ToString(), photo.Length, photo.Width, photo.Material, photo.Style, photo.Price);
 }