QuestionQuestion

Transcribed TextTranscribed Text

Assignment 3 Program Description In this assignment, you will extend the Library application that you developed for Assignment 2. 1. You do not have to create a new project in Visual Studio, you can work on the project you created for Assignment 2. You MUST leave the name of this project as A2_YourLastNameYourFirstName. 2. Add the keyword override to the ToString() method headers in the Customer, Book, and Library class. 3. Add a subclass of Book class called TextBook with: a. A private integer type attribute called edition. b. A constructor that takes the title, author, catalog number and edition as parameters c. ToString() method that returns the catalog number, title, author and edition information in the format shown in sample output. 4. Add another subclass of Book class called GeneralBook with: a. no extra attributes. b. A constructor that takes the title, author, and catalog number as parameters. 5. Change the AddNewBook(…) method in the Library class so that it creates a GeneralBook object instead of Book object. Everything else remains the same. 6. 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. 7. 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. ALL attributes MUST be declared as private. 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 METHOD BUT THE Main method. Sample Output

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

using System;
using System.Collections.Generic;
using System.Text;

namespace A2_
{
    class Book
    {
       // private attributes:
       private int catalogNumber; // – book’s catalog number
       private string title;      // – book’s title
       private string authors;    // – book’s authors
       private Customer c;       // - reference to the customer to who
       // the book is issued, if at all.


       // public properties:
       // Read-only property for catalogNumber
       public int CatalogNumber
       {
            get => catalogNumber;
       }
       // Constructor:

       /// <summary>
       /// – constructor that initializes the
       /// title, author and catalog number attributes to the values passed.
       /// </summary>
       /// <param name="title"></param>
       /// <param name="authors"></param>
       /// <param name="catalogNo"></param>
       public Book(string title, string authors, int catalogNo)
       {
            this.title = title;
            this.authors = authors;
            this.catalogNumber = catalogNo;
            c = null;
       }

       /// <summary>
       /// constructor that does not take any parameters and initializes
       /// the attributes to their default values.
       /// </summary>
       public Book()
       {
            this.title = "";
            this.authors = "";
            this.catalogNumber = 0;
            c = null;
       }...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$20.00
for this solution

or FREE if you
register a new account!

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