예제 #1
0
파일: BookShop.cs 프로젝트: jechev/OOP
 static void Main(string[] args)
 {
     Book book=new Book("Pod Igoto","Ivan Vazov",19.99m);
     Console.WriteLine(book);
     GoldenEditionBook goldenBook=new GoldenEditionBook("Tutun","Dimitar Dimov",22.90m);
     Console.WriteLine(goldenBook);
 }
 static void Main()
 {
     Book book = new Book("Pod igoto","Ivan Vazov",15.90m);
     Console.WriteLine(book);
     Console.WriteLine();
     GoldenEditionBook goldBook = new GoldenEditionBook("Tutun","Dimitur Dimov",22.90m);
     Console.WriteLine(goldBook);
 }
예제 #3
0
파일: Program.cs 프로젝트: Penkov/OOP
        static void Main(string[] args)
        {
            Book podigoto = new Book("Pod Igot", "Ivan Vazav", 35.0m);

            GoldenEditionBook perfe = new GoldenEditionBook("Perfe", "perfection", 5.0m);

            Console.WriteLine(podigoto.ToString());
            Console.WriteLine(perfe.ToString());
        }
예제 #4
0
        static void Main(string[] args)
        {
            Book book1 = new Book("Kama sutra", "Ne znam ot koi e", 60.00m);
            GoldenEditionBook goldenEd = new GoldenEditionBook("Qka kniga", "Ot men", 110.00m);

            Console.WriteLine(book1);
            Console.WriteLine();
            Console.WriteLine(goldenEd);
        }
예제 #5
0
        static void Main()
        {
            Book book = new Book("Be phenomenal or be forgotten", "Erick Thomas", 17.0);

            GoldenEditionBook goldenBook = new GoldenEditionBook("Be phenomenal or be forgotten", "Erick Thomas", 17.0);

            Book mixBook = new GoldenEditionBook("Be phenomenal or be forgotten", "Erick Thomas", 17.0);

            Console.WriteLine("{0}\n{1}\n{2}\n{3}",book,goldenBook,mixBook, mixBook as GoldenEditionBook);
        }
예제 #6
0
        static void Main(string[] args)
        {
            Book book1 = new Book();
            book1.Title = "Head First C#";
            book1.Author = "O'Reilly";
            book1.ISBN = "0596009208";
            book1.Price = 25.99;
            book1.NumberOfPages = 720;

            Book book2 = new Book();
            book2.Title = "C# How To Program";
            book2.Author = "Deitel";
            book2.ISBN = "0131364839";
            book2.Price = 29.99;
            book2.NumberOfPages = 1560;

            Book book3 = new Book();
            book3.Title = "Head First Design Patterns";
            book3.Author = "O'Reilly";
            book3.ISBN = "0596007124";
            book3.Price = 22.49;
            book3.NumberOfPages = 694;

            Book[] books = { book1, book2, book3 };

            Checkout checkout = new Checkout();
            double totalPrice = checkout.CalculatePrice(books);

            Console.WriteLine("Total price of books: " + totalPrice);

            // ... next out BookShop functionality was extended to cope with ISellable and IBuyable interfaces

            Magazine mag = new Magazine();

            ISellable[] sellables = { book1, book2, mag };
            foreach(ISellable item in sellables)
            {
                item.Sell();
            }

            IBuyable[] buyables = { book1, book2 }; // <-- NOTE we can't add the Magazine because it's not an IBuyable object
            foreach (IBuyable item in buyables)
            {
                item.Buy();
            }

            IOpenCloseable[] openCloseables = { book1, book2, mag }; // <-- NOTE we can't add the Magazine because it's not an IBuyable object
            foreach (IOpenCloseable item in openCloseables)
            {
                item.Open();
                item.Close();
            }

            Console.ReadLine();
        }
예제 #7
0
 public double CalculatePrice(Book[] books)
 {
     double priceTotal = 0.0;
     if (books != null)
     {
         foreach (Book book in books)
         {
             priceTotal =+ book.Price;
         }
     }
     return priceTotal;
 }
예제 #8
0
 public AreYouSureDeleteBook(Book bookInQuestion)
 {
     this.bookInQuestion = bookInQuestion;
     Button button = new Button();
     button.Text = "Так.";
     button.Location = new Point(10, 10);
     button.Height = 40;
     button.Width = 40;
     button.Click += new EventHandler(yesClick);
     this.Controls.Add(button);
     //no
     Button noButton = new Button();
     noButton.Text = "Ні.";
     noButton.Location = new Point(60, 10);
     noButton.Height = 40;
     noButton.Width = 40;
     noButton.Click += new EventHandler(noClick);
     this.Controls.Add(noButton);
 }
예제 #9
0
 static void Main(string[] args)
 {
     Book sashko = new Book("Pod Igoto","Ivan Vazov", 8.50);
     Console.WriteLine(sashko);
 }
예제 #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     Book newBook = new Book(textBox1.Text, textBox2.Text);
     AllBooks.BookList.Add(newBook);
     this.Hide();
 }
예제 #11
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="bookInQuestion"></param>
 public ButtonDeleteBook(Book bookInQuestion)
 {
     this.bookInQuestion = bookInQuestion;
     this.Click += new System.EventHandler(this.ButtonSubclass_Click);
 }