Java Programming Create a subclass of ReadingMaterial called Manga- should call
ID: 3808703 • Letter: J
Question
Java Programming
Create a subclass of ReadingMaterial called Manga- should call superclass constructors
-------------------------------------------------------------------
--------------------------------------------------------------------
(this is what I made little bit..)
public class Manga extends ReadingMaterial{
/*
* constructor for class Manga and class its parent class constructor
*/
public Manga(){
super();
System.out.println("Manga class constructor");
System.out.println();
}
/*
* Display Method
*/
public void display(){
System.out.println("Display method of Manga is called");
}
}
Manga name: String author: String size: Rectangle numPages int typicalReadingorder: boolean Manga(publisher String, name: String, author: String, size:Rectangle numPages:int, typicalReadingorder: boolean) getName() String get Size(): Rectangle get NumPages(): int getAuthor(): String setName (String) void setSize (Rectangle) void setNumPages (int) void setAuthor(String) void get TypicalReadingorder(): boolean setTypicalReadingorder n) void to String String ReadingMaterial title True if back-to-front, false if front-to-backExplanation / Answer
public class Manga extends ReadingMaterial {
private String name;
private String author;
private Rectangle size;
private int numPages;
private boolean typicalReadingOrder;
public Manga(String name, String author, Rectangle size, int numPages, boolean typicalReadingOrder) {
super(); // you may need to change this
this.name = name;
this.author = author;
this.size = size;
this.numPages = numPages;
this.typicalReadingOrder = typicalReadingOrder;
}
/*Setters and Getters */
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Rectangle getSize() {
return size;
}
public void setSize(Rectangle size) {
this.size = size;
}
public int getNumPages() {
return numPages;
}
public void setNumPages(int numPages) {
this.numPages = numPages;
}
public boolean isTypicalReadingOrder() {
return typicalReadingOrder;
}
public void setTypicalReadingOrder(boolean typicalReadingOrder) {
this.typicalReadingOrder = typicalReadingOrder;
}
@Override
public String toString() {
return "Manga{" + " name=" + name + ", author=" + author + ", size=" + size + ", numPages=" + numPages + ", typicalReadingOrder=" + typicalReadingOrder + " }";
}
}
Hello champ... This is how your code should look like. I hope you have the ReadingMaterial class and the Rectangle class. You may need to change the call to super class constructor, which may include params. please check compatibility.