In this assignment, you will develop a Console Application related to a simple library system. You must develop code for all the following classes as described.
1. Create a new project
2. Add a class called Customer to the project
Copy the code from Customer.cs file provided to you into this class
3. Add a class called Book and add code for the following:
a. private attributes:
• int catalogNumber – book’s catalog number
• string title – book’s title • string authors – book’s authors
• Customer c - reference to the customer to who the book is issued, if at all.
b. public properties:
• CatalogNumber with only the get part
c. Public methods:
• Book(string title, string authors, int catalogNo) – constructor that initializes the title, author and catalog number attributes to the values passed.
• string ToString() - returns a string containing the book’s catalog number, title, authors of the book followed by check-out information. If the book is not checked out the check-out information should be “Available”; otherwise it should say “Checkedout to Customer “ followed by the id of the customer to whom it is checked out to. See sample output for an example.
• bool CheckOut(Customer c): issues the book to the customer c if the book is not already checked out and returns true. But if the book is already checked out, it returns false.
• bool CheckIn(): checks-in the book to the library if the book is checked out and returns true. But if the book was not checked out, it returns false.
4. Add a class called Library and add the code for:
a. private attributes:
• customerArray which is an array of Customers of size 5
• bookArray which is an array of Books of size 5
b. public methods:
• bool AddNewCustomer(string customerName): if the number of customers already added is less than the size of the customerArray , this method will create a new Customer object with the given name and unique id (the first customer should get an id of 1, the second customer should get an id of 2, and so on.), and add it to the customerArray. This method will return true if the customer was successfully added else it will return false. You may have to add private attributes to the Library class to generate unique customer ids.
• bool AddNewBook(string bookTitle, string bookAuthor): if the number of books already added is less than the size of the bookArray, this method will create a new Book object with the given title, author and a unique catalogNumber (the first book should get a catalog number of 101, the second book should get catalog number of 102, and so on.), and add it to the bookArray. This method will return true if the book was successfully added else it will return false. You may have to add private attributes to the Library class to generate unique book catalog numbers.
• string ToString( ): will return a string which has information about all the customers of the library, each customer’s information in a new line followed by the information about all the books of the library, each book’s information in a new line. It should use the ToString() method of Customer and Book class. See sample output for exact format.
5. Copy the code in the Main() method from the attached file Program.cs to the Main() method of your project. 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.
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 METHOD BUT THE Main method.
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;
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 Book(string title, string authors, int catalogNumber)
this.title = title;
this.authors = authors;
this.catalogNumber = catalogNumber;
c = null;
public int getCatalogNumber()
public bool CheckOut(Customer ct)
if (c == null)
c = ct;