C# - C Sharp: Practical 12: Books Management System
BOOKS MANAGEMENT SYSTEM
In this exam, you’ll have to create a Books Management system. The system allows input, list, search … books.
1. Create an interface name IBook contains these properties and methods:
a. Properties
· ID (int)
· Name (string)
· PublishDate (DateTime)
· Author (string)
· Language (string)
· AveragePrice (float) – Read only property
b. Methods
· void Display()
2. Create a class name Book:
a. Implements the IBook interface in step 1
b. The method Display will print all Name, PublishDate, Author, Language and AveragePrice of the book to the console
c. Declare an array name PriceList type int has size of 5 elements
d. Create an indexer uses the array PriceList in step 2c.
e. Create a method named Calculate to set AveragePrice = average of 5 int elements in PriceList array.
3. Display a tasks menu to choose:
1. Insert new book
2. View list of books
3. Average Price
4. Exit
4. If user type 1 from keyboard then:
a. Create a new Book instance and input Name, PublishDate, Author, Language and then ask user to enter 5 prices and set to the instance indexer
- The ID is auto increament ( ID++ )
- Be sure to check format of PublishDate
b. Create a Dictionary<int, Book> to keep the Book instance in step a with key = ID and value = the book instance
5. If user type 2 from keyboard then:
Loop from all book instances in the Dictionary<int, Book> then executes the Display method from IBook interface.
6. If user type 3 from keyboard then:
Loop from all book instances in the Dictionary<int, Book> then executes the Calculate method and then execute the Display method.
7. While user not chooses Exit (type 4 from keyboard) then go back to the menu step 3 to ask user chooses an option.