Question: You will write a C# program for a small bookstore that deals in both printed books and audiobooks. You will create a base class called
You will write a C# program for a small bookstore that deals in both printed books and audiobooks.
You will create a base class called Book with the following members:
ISBN String type Property: autoimplemented getter and setter.
Price Double type Property: define getter and setter. The setter will check the validity of
the value that must be less than $ before setting. If it is more than $ it will be set to
$
Title String type Property: autoimplemented getter and setter.
Author String type Property: autoimplemented getter and setter.
SalePrice Double type Property: No setter. The getter will add profit to the Price and
return this value.
ShowInfo void type public method: This will print the ISBN, title, author, and the sale
price.
The Book class will be extended to create an Audiobook child class. This will have additional public
Properties called Length in hours, integer type and Narrator string type These will store the
length of the audiobook and the name of the person who narrated the book, respectively. Both
properties will have autoimplemented getter and setter.
The Audiobook class will override the following members of the parent class:
Price: define getter and setter. The setter will check the validity of the value that must be
less than $ before setting. If it is more than $ it will be set to $
SalePrice Double type Property: No setter. The getter will add profit to the Price and
return this value.
ShowInfo void type public method: This will print the ISBN, title, author, length, narrator,
and the sale price.
Feel free to define any additional private backing fields as required in both classes.
You will write a static class called BookstoreInventory that will contain the Main method. The main
method will create two arrays of objects: books and audiobooks. The lengths of the arrays will be
and respectively. The user will be given options to choose in a loop: add a book, add an
audiobook, show inventory, and quit. You can use any letters or numbers for these options. Adding
a book will ask the user to input ISBN, Price, Title, and Author of the book object. Adding an
audiobook will ask for additional values for the length and narrator. The show inventory option
will ask for the type and title or author of the book. Based on user input, it will search the
appropriate array book or audiobook When a match for the title or author is found, it will call
the ShowInfo method of the object. Keep in mind that there could be more than one match for the
title or author, and your program will show info for all of them. You should use additional variables
to keep track of the number of books and audiobooks added to the inventory. You should also
check for the limit of the size of the arrays.
Important: Do NOT use any C# languagefeatures or data input methods that has not been
taught in the class. Check the lecture slides to verify this. Some concepts may exist in the
textbook, but we did not learn those in the class. You are NOT allowed to use these. Submissions
that utilize any C# languagefeatures beyond the lecture slides will automatically receive in
the assignment.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
