Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA Programming Create a subclass of ReadingMaterial called Book- should call s

ID: 3808704 • Letter: J

Question

JAVA Programming

Create a subclass of ReadingMaterial called Book- should call superclass constructors

This is what i made little bit

public class Book extends ReadingMaterial {

   /*

   * constructor for class Book and class its parent class constructor

   */

   public Book(){

       super();

       System.out.println("Book class constructor");

       System.out.println();

   }

  

   /*

   * Display Method

   */

   public void display(){

       System.out.println("Display method of Book is called");

   }

}

Book ReadingMaterial name: String title author: String size: Rectangle numPages nt ISBN String Book (publisher String, name: String, author: String, size: Rectangle, n ISBN: String) getName(): String get size() Rectangle getNumPages(): int getAuthor(): String setName (String) void setSize(Rectangle) void setNumPages(int) void setAuthor(String) void getISBNO: String setlSBN (String) void toString0 String

Explanation / Answer

public class ReadingMaterial
{
private String title;
  
ReadingMaterial(){
  
}
ReadingMaterial(String title){
this.title=title;
  
}
  
}


/* Name of the class has to be "Main" only if the class is public. */
public class Book extends ReadingMaterial {

private String name;
private String author;
private Rectangle size;
private int numPages;
private String ISBN;


/*
* constructor for class Book and class its parent class constructor
*/
public Book(){
super();
System.out.println("Book class constructor");
System.out.println();
}
public Book(String publisher,String name, String author, int numPages,String ISBN)
{
super();
this.publisher=publisher;
this.name=name;
this.author=author;
this.numPages=numPages;
this.ISBN=ISBN;
}

public String getName(){
return name;
  
}
public void setName(){
this.name=name;
}

public String getAuthor(){
return author;
  
}
public void setAuthor(){
this.author=author;
  
}
public int getNumPages(){
return numPages;
}
public void setNumPages(){
this.numPages=numPages;
}
public Rectangle getSize(){
return size;
}
public void setSize(){
this.size=size;
  
}
public void setISBN(){
this.ISBN=ISBN;
}
public String getISBN(){
return ISBN;
}
/*
* Display Method
*/
public void display(){
System.out.println("Display method of Book is called");
}
}