QuestionQuestion

Program Description

1. Add a subclass of Book class called TextBook with an integer type attribute called edition.

2. Add another subclass of Book class called GeneralBook with no extra attributes.

3. Add a protected attribute called dueDate of type DateTime in the Book class and make the Customer c attribute of Book class as protected.

4. Add the following public abstract method to the Book class: DateTime findDueDate()

This method is supposed to calculate and return the due date of a book when it is checked out.

5. Change the CheckOut() method in the Book class so that it not only sets the Customer c attribute but also sets the dueDate attribute to the value returned by the findDueDate() method.

6. Override the findDueDate() method in the TextBook class so that it computes and returns a date 30 days from the date of checkout. Override the findDueDate() method in the GeneralBook class so that it computes and returns a date 7 days from the date of checkout. Refer to the DateTime class documentation on MSDN website to see how to achieve this.

7. Change the ToString() method in the Book class so that it also returns the dueDate information in the format shown in the sample output.

8. Override the ToString() method in the TextBook class so that it also returns the edition information.

9. Add an interface called IRenewable to the project with a method: bool Renew().

10. Make the TextBook class implement IRenewable to allow a textbook to be renewed so that it is made due 15 days beyond the current due date. If the book is not checked out, the renew() should return false.

11. Change the AddNewBook(..) method in the Library class so that it creates a GeneralBook object instead of Book object. Everything else remains the same.

12. Add the following public methods in the Library class
• public bool AddNewBook(string bTitle, string bAuthor, int edition): if the number of books already added is less than the size of the bookArray, this method will create a new TextBook object with the given title, author, edition, and unique catalogNumber, and add it to the bookArray. This method will return true if the textbook was successfully added else it will return false.

• bool IssueBook(int custId, int bookCatalogNum): which will issue the book with catalogNumber = bookCatalogNum to the customer with id = custId if the book was not already issued to somebody else and return true; otherwise it will return false. This method should call the CheckOut( ) method of the Book class.   

• bool ReturnBook(int bookCatalogNum): which will return the book with catalogNumber = bookCatalogNum to the library if the book was in checked-out status and return true; otherwise it will return false. This method should call the CheckIn( ) method of the Book class.

• boolean RenewBook(int bookCatalogNum): Returns a false if the product with the given catalog number is not renewable or if the product with the given catalog number is not checked out. Otherwise renews the product and returns true.

13. Use the Main method given in the attached file Program.cs. The sample output for this Main method is given below. Note that the TA may change the Main method when he is testing your code.

Important

1. DO NOT MAKE any attribute public.
2. DO NOT ADD any attributes other than what has been asked for.
3. DO NOT ADD any extra public methods or properties.
4. You may add private methods if you like to make your code modular.
5. DO NOT DUPLICATE code.
6. THERE SHOULD BE NO PRINT STATEMENTS IN ANY OTHER CLASS BUT THE Main CLASS.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A4
{
    abstract class Book
    {
       private int catalogNumber;
       private string title;
       private string authors;
       protected Customer c;
       protected DateTime dueDate;

       public Book(string title, string authors, int catalogNumber)
       {
            this.title = title;
            this.authors = authors;
            this.catalogNumber = catalogNumber;
            c = null;
       }

       public Customer getCustomer()
       {
            return c;
       }

       public int getCatalogNumber()
       {
            return catalogNumber;
       }...
$40.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats