using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication41 { class Book { public Book(string Autor, string Name, string Publish, int Printing, double Price) { this.Autor = Autor; this.Name = Name; this.Publish = Publish; this.Printing = Printing; this.Price = Price; } public string Autor; public string Name; public string Publish; public int Printing; public double Price; public String setAutor { set { this.Autor = value; } get { return this.Autor; } } public String setName { set { this.Name = value; } get { return this.Name; } } public String setPublish { set { this.Publish = value; } get { return this.Publish; } } public Int32 setPrinting { set { this.Printing = value; } get { return this.Printing; } } public Double setPrice { set { this.Price = value; } get { return this.Price; } } } class Lib { public Book[] arrLib = new Book[10]; public int Length { get { return arrLib.Length; } } public Book this[int index] { get { return arrLib[index]; } set { arrLib[index] = value; } } public void showBook() { int Ind; Console.WriteLine("Введите номер книги для просмотра данных"); Ind= (Convert.ToInt32(Console.ReadLine()))+1; Console.WriteLine("{0},{1},{2},{3},{4}", this.arrLib[Ind].Autor, this.arrLib[Ind].Name, this.arrLib[Ind].Publish, this.arrLib[Ind].Printing, this.arrLib[Ind].Price); } public void editBook() { string Temp; int TPrinting; double TPrice; int Ind; Console.WriteLine("Введите номер книги для редактирования"); Ind = (Convert.ToInt32(Console.ReadLine())) + 1; Console.WriteLine("Автор"); Temp = Console.ReadLine(); this.arrLib[Ind].setAutor = Temp; Console.WriteLine("Имя"); Temp = Console.ReadLine(); this.arrLib[Ind].setName = Temp; Console.WriteLine("Издательство"); Temp = Console.ReadLine(); this.arrLib[Ind].setPublish = Temp; Console.WriteLine("Тираж"); TPrinting = Convert.ToInt32(Console.ReadLine()); this.arrLib[Ind].setPrinting = TPrinting; Console.WriteLine("Цена"); TPrice = Convert.ToDouble(Console.ReadLine()); this.arrLib[Ind].setPrice = TPrice; } public double bookSum() { double Sum =0; for (int i =0; i < arrLib.Length;i++) { Sum = Sum + arrLib[i].Price; } return Sum; } } }