two left
This commit is contained in:
64
labs/lab6_done/Book/Book.cs
Normal file
64
labs/lab6_done/Book/Book.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
|
||||
class Book
|
||||
{
|
||||
private String author;
|
||||
private String title;
|
||||
private String publisher;
|
||||
private int pages;
|
||||
private int year;
|
||||
|
||||
private static double price = 9;
|
||||
|
||||
static Book()
|
||||
{
|
||||
price = 10;
|
||||
}
|
||||
|
||||
public Book()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Book(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 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 void Show()
|
||||
{
|
||||
Console.WriteLine("\nКнига:\n Автор: {0}\n Название: {1}\n Год издания: {2}\n {3} стр.\n Стоимость аренды: {4}", author, title, year, pages, Book.price);
|
||||
}
|
||||
|
||||
public double PriceBook(int s)
|
||||
{
|
||||
double cost = s * price;
|
||||
return cost;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user