Advertisement
AleYalunin

Untitled

Dec 3rd, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace HW5
  5. {
  6. class MainClass
  7. {
  8. public static void Main()
  9. {
  10. Book[] books;
  11. List<Book> booksList;
  12. Book DonQuijote = new Book("DonQuijote", "Cervantes", 1605, 5, 99.99);
  13. DonQuijote.showBookInfo();
  14. Console.ReadLine();
  15. }
  16.  
  17. static void showBooksFromArray(Book[] books)
  18. {
  19. foreach (Book book in books)
  20. {
  21. Console.WriteLine(Book.title);
  22. }
  23. }
  24.  
  25. static void showBooksFromList(List<Book> books)
  26. {
  27. throw new NotImplementedException();
  28. }
  29. }
  30. }
  31. using System;
  32. using System.Collections.Generic;
  33.  
  34. namespace HW5
  35. {
  36. public class Shelf
  37. {
  38. Book[] books = new Book[2];
  39. List<Book> booksList;
  40. uint idShelf;
  41. uint idStellage;
  42.  
  43. public Shelf(Book[] books, uint idShelf, uint idStellage)
  44. {
  45. this.books = books;
  46. this.idShelf = idShelf;
  47. this.idStellage = idStellage;
  48. }
  49.  
  50. public bool addBookToArray(Book item)
  51. {
  52. this.books[0] = item;
  53. return true;
  54. }
  55.  
  56. public bool addBookToList(Book item)
  57. {
  58. throw new NotImplementedException();
  59. }
  60.  
  61. public bool removeBookFromArray(Book item)
  62. {
  63. throw new NotImplementedException();
  64. }
  65.  
  66. public bool removeBookFromList(Book item)
  67. {
  68. throw new NotImplementedException();
  69. }
  70.  
  71. private Book[] resizeBookArray(Book[] items)
  72. {
  73. items = new Book[items.Length * 2];
  74. return items;
  75. }
  76.  
  77. public void showBooksOnShelf()
  78. {
  79. throw new NotImplementedException();
  80. }
  81. }
  82. }
  83. using System;
  84.  
  85. namespace HW5
  86. {
  87. public class Book
  88. {
  89. static int count;
  90. private string title;
  91. private string author;
  92. private int year;
  93. private uint quantity;
  94. private double price;
  95.  
  96. public Book(string title, string author, int year, uint quantity, double price)
  97. {
  98. this.title = title;
  99. this.author = author;
  100. this.year = year;
  101. this.quantity = quantity;
  102. this.price = price;
  103. count++;
  104. }
  105.  
  106. public void showBookInfo()
  107. {
  108. Console.WriteLine("Title: " + title + ", Author:" + author + ", Year: " + year + ", Price: " + price);
  109. }
  110.  
  111. public void showBookCount()
  112. {
  113. Console.WriteLine("Quantity of this book: " + quantity);
  114. }
  115.  
  116. public void showLibraryBookCount()
  117. {
  118. Console.WriteLine("Quantity of all books in library: " + count);
  119. }
  120. }
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement