Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace HW5
- {
- class MainClass
- {
- public static void Main()
- {
- Book[] books;
- List<Book> booksList;
- Book DonQuijote = new Book("DonQuijote", "Cervantes", 1605, 5, 99.99);
- DonQuijote.showBookInfo();
- Console.ReadLine();
- }
- static void showBooksFromArray(Book[] books)
- {
- foreach (Book book in books)
- {
- Console.WriteLine(Book.title);
- }
- }
- static void showBooksFromList(List<Book> books)
- {
- throw new NotImplementedException();
- }
- }
- }
- using System;
- using System.Collections.Generic;
- namespace HW5
- {
- public class Shelf
- {
- Book[] books = new Book[2];
- List<Book> booksList;
- uint idShelf;
- uint idStellage;
- public Shelf(Book[] books, uint idShelf, uint idStellage)
- {
- this.books = books;
- this.idShelf = idShelf;
- this.idStellage = idStellage;
- }
- public bool addBookToArray(Book item)
- {
- this.books[0] = item;
- return true;
- }
- public bool addBookToList(Book item)
- {
- throw new NotImplementedException();
- }
- public bool removeBookFromArray(Book item)
- {
- throw new NotImplementedException();
- }
- public bool removeBookFromList(Book item)
- {
- throw new NotImplementedException();
- }
- private Book[] resizeBookArray(Book[] items)
- {
- items = new Book[items.Length * 2];
- return items;
- }
- public void showBooksOnShelf()
- {
- throw new NotImplementedException();
- }
- }
- }
- using System;
- namespace HW5
- {
- public class Book
- {
- static int count;
- private string title;
- private string author;
- private int year;
- private uint quantity;
- private double price;
- public Book(string title, string author, int year, uint quantity, double price)
- {
- this.title = title;
- this.author = author;
- this.year = year;
- this.quantity = quantity;
- this.price = price;
- count++;
- }
- public void showBookInfo()
- {
- Console.WriteLine("Title: " + title + ", Author:" + author + ", Year: " + year + ", Price: " + price);
- }
- public void showBookCount()
- {
- Console.WriteLine("Quantity of this book: " + quantity);
- }
- public void showLibraryBookCount()
- {
- Console.WriteLine("Quantity of all books in library: " + count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement