theme changed

This commit is contained in:
nik
2025-09-30 08:21:09 +03:00
parent 4c261f7def
commit 8bd93df2ae
917 changed files with 15023 additions and 0 deletions

102
labs/lab9/MyClass/Book.cs Normal file
View File

@@ -0,0 +1,102 @@
using System;
class Book : Item
{
private String author;
private String title;
private String publisher;
private int pages;
private int year;
private static double price = 9;
private bool returnSrok = false;
static Book()
{
price = 10;
}
public Book()
{
}
public Book(String author, String title, String publisher, int pages, int year, long invNumber, bool taken) : base (invNumber, taken)
{
this.author = author;
this.title = title;
this.publisher = publisher;
this.pages = pages;
this.year = year;
}
public Book(String author, String title)
{
this.author = author;
this.title = title;
}
public void SetBook(String author, String title, String publisher, int pages, int year)
{
this.author = author;
this.title = title;
this.publisher = publisher;
this.pages = pages;
this.year = year;
}
public static void SetPrice(double price)
{
Book.price = price;
}
public override void Show()
{
Console.WriteLine("\nКнига:\n Автор: {0}\n Название: {1}\n Год издания: {2}\n {3} стр.\n Стоимость аренды: {4}", author, title, year, pages, Book.price);
base.Show();
}
public double PriceBook(int s)
{
double cost = s * price;
return cost;
}
public override void Return()
{
taken = ReturnSrok;
}
public delegate void ProcessBookDelegate(Book book);
public void ProcessPaperbackBooks(ProcessBookDelegate processBook)
{
if (ReturnSrok)
processBook(this);
}
public static event ProcessBookDelegate RetSrok;
public bool ReturnSrok
{
get
{
return returnSrok;
}
set
{
returnSrok = value;
if (ReturnSrok == true)
RetSrok(this);
}
}
public override string ToString()
{
string str = this.title + ", " + this.author + " Инв. номер " + this.invNumber;
return str;
}
}