Design a console program that will print details of prescribed textbooks of students. Make use of an abstract class Book with variables that will store the author, title, category and price of a book. Create a constructor that accepts the author, title and category through parameters and assign these to the class variables. Create an abstract set method for the price of a book; also create get methods for the variables. Create a subclass TextBook that extends the Book class and implements an iPrintable interface. The interface that must be added is shown below: public interface iPrintable { String DisplayDetails(); } The TextBook subclass has a private variable named yearPrescribed for which a get method must be written. The constructor of the TextBook class must accept the author, title, category and yearPrescribed through parameters. Write the code for the setPrice() and DisplayDetails() methods. Write a useBook class and instantiate 2 objects of the TextBook class.
Design a console program that will print details of prescribed textbooks of students. Make use of an abstract class Book with variables that will store the author, title, category and price of a book. Create a constructor that accepts the author, title and category through parameters and assign these to the class variables. Create an abstract set method for the price of a book; also create get methods for the variables.
Create a subclass TextBook that extends the Book class and implements an iPrintable interface. The interface that must be added is shown below:
public interface iPrintable { String DisplayDetails();
}
The TextBook subclass has a private variable named yearPrescribed for which a get method must be written. The constructor of the TextBook class must accept the author, title, category and yearPrescribed through parameters. Write the code for the setPrice() and DisplayDetails() methods.
Write a useBook class and instantiate 2 objects of the TextBook class.
Trending now
This is a popular solution!
Step by step
Solved in 6 steps with 5 images