in java A class Book is designed to model a book written by one author. It contains: Four private instance variables: name (String), price (double) static, and qty (int); Two constructors: public Book...


in java A class  Book is designed  to model a book written by
one author. It contains:



  • Four private instance variables: name (String), price (double) static, and qty (int);

  • Two constructors:

  • public Book (String name, double price) { ...... }

  • public Book (String name, double price, int qty) { ...... }

  • getters/setters methods getName(), getPrice(), setPrice(), getQty(), setQty().

  • A toString() that returns book values.






A class called Author is designed to model a book's author. It contains:



  • Four private instance variables: name (String), email (String), and gender (char of either 'm' or 'f') and arrayList of Books.

  • One constructor to initialize the name, email and gender with the given values;


public Author (String name, String email, char gender) {......}



  • public getters/setters.

    A toString() method that returns author object.

  • A method addBook(Book b) which will add book in the Arraylist of books.

  • A removeBook(String name) method which remove particular book form the list.


Also write a test driver called  to test all the public methods in the class Author.



Jun 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here