Test C# Practical
Test C# Practical
youll 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: (Total : 4
points) a. Properties
i. ID (int) ii. Name (string) iii. PublishDate (DateTime) iv. Author (string) v. Language (string) vi. AveragePrice (float) Read only property
AveragePrice of the book to the console c. Method Delete(int id) will be return true if delete success a book else return false
d. Method Find(int id) will be display all information if find a book and display
f. Create an indexer uses the array PriceList g. Create a method named Calculate to set AveragePrice = average of 5 int
a. Create a Hastable or dictionary (create only one Hastable or Dictionary) to keep the Book instance in step a with key = ID and value = the Book instance
b. 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 PublishDat
5. If user type 2 from keyboard then:
Loop from all book instances in the Hastable then executes the Display method from IBook interface.
6. If user type 3 from keyboard then:
Method AveragePrice Loop from all book instances in the Hastable then executes the Calculate method and then executes the Display method
9. While user not chooses Exit (type 4 from keyboard) then go back to the menu step 3
to ask user chooses an option. 10. handling all exception can occur.