We are designing a class Library that contains an ArrayList of books. For simpli
ID: 3660092 • Letter: W
Question
We are designing a class Library that contains an ArrayList of books. For simplicity, the books are represented by their String name. Library has a method to add a book to the Library. It also has a method that returns a String with the names of all the books - one to a line You are to complete this class by adding your code in the places marked with // your code here. Upload it along with the tester import java.util.ArrayList; public class Library { // your code here /** * Constructor for objects of class Library */ public Library() { // your code here } /** * adds a book to this Library * @param book the name of the book to add */ public void add(String book) { //your code here } /** * Gets a string representation of this library * @return a string conaining all the books in this library in this form Library[ book1 book2 ] */ public String toString() { String list = "Library[ "; // your code here return list; } }Explanation / Answer
Below are 2 codes for class library where getdata class is used to add the new books into the database of class library................. class library { public: char name[20]; char author[20]; int a; void getdata(); }; void library::getdata() { cout< author; fflush(stdin); cout< >a; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.