Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication22
  8. {
  9. class Books
  10. {
  11. private string author, title, price;
  12.  
  13. public void set(string a,string t, string p)
  14. {
  15. this.author = a;
  16. this.title = t;
  17. this.price = p;
  18. PrintBook();
  19. }
  20.  
  21. public void PrintBook()
  22. {
  23. Console.WriteLine("Автор: {0}\nНазвание: {1}\nЦена: {2}\n", author, title, price);
  24. }
  25.  
  26. }
  27.  
  28. class Program
  29. {
  30. static void Main(string[] args)
  31. {
  32.  
  33. Books obj = new Books();
  34.  
  35. obj.set("Пушкин", "Руслан и Людмила", "100");
  36. obj.set("Толстой", "Война и мир", "200");
  37. obj.set("Барто", "Сборник детских стихов", "150");
  38. Console.ReadKey();
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement