78 lines
2.2 KiB
C#
78 lines
2.2 KiB
C#
using System;
|
||
|
||
public class Program
|
||
{
|
||
public static void Main(string[] args)
|
||
{
|
||
Book b1 = new Book();
|
||
b1.SetBook("Пушкин А.С.", "Капитанская дочка", "Вильямс", 123, 2012);
|
||
Book.SetPrice(12);
|
||
b1.Show();
|
||
Console.WriteLine("\n Итоговая стоимость аренды: {0} р.", b1.PriceBook(3));
|
||
|
||
// Book b2 = new Book("Толстой Л.Н.", "Война и мир", "Наука и жизнь", 1234, 2013);
|
||
// b2.Show();
|
||
|
||
Book b3 = new Book("Лермонтов М.Ю.", "Мцыри");
|
||
b3.Show();
|
||
|
||
|
||
Triangle t1 = new Triangle(3, 4, 5);
|
||
t1.Show();
|
||
Console.WriteLine("perimeter = {0}", t1.Perimeter());
|
||
Console.WriteLine("area = {0}", t1.Area());
|
||
Console.WriteLine("does this triangle exist? {0}", t1.Exists());
|
||
|
||
Triangle t2 = new Triangle(3, 4, 7);
|
||
t2.Show();
|
||
Console.WriteLine("does this triangle exist? {0}", t2.Exists());
|
||
|
||
// Item item1 = new Item();
|
||
// item1.Show();
|
||
|
||
Book b2 = new Book("Толстой Л. Н.", "Война и мир", "Наука и жизнь", 1234, 2013, 101, true);
|
||
|
||
b2.Show();
|
||
b2.TakeItem();
|
||
b2.Show();
|
||
|
||
|
||
// Magazine mag1 = new Magazine("О природе", 5, "Земля и мы", 2014, 1235, true);
|
||
// mag1.Show();
|
||
|
||
Console.WriteLine("\n Тестирование полиформизма");
|
||
Item it;
|
||
|
||
it = b2;
|
||
it.TakeItem();
|
||
it.Return();
|
||
it.Show();
|
||
|
||
// it = mag1;
|
||
// it.TakeItem();
|
||
// it.Return();
|
||
// it.Show();
|
||
|
||
|
||
Magazine mag1 = new Magazine("О природе", 5, "Земля и мы", 2014, 1235, true);
|
||
mag1.TakeItem();
|
||
mag1.Show();
|
||
mag1.IfSubs = true;
|
||
mag1.Subs();
|
||
|
||
Item[] items = new Item[4];
|
||
items[0] = b1;
|
||
items[1] = b2;
|
||
items[2] = b3;
|
||
items[3] = mag1;
|
||
|
||
Array.Sort(items);
|
||
|
||
Console.WriteLine("\nСортировка по инвентарному номеру");
|
||
foreach (Item x in items)
|
||
{
|
||
x.Show();
|
||
}
|
||
}
|
||
}
|