import java.util.*;
abstract class Book {
String title;
String author;
Book(String title, String author) {
this.title = title;
this.author = author;
}
abstract void display();
}
//-----------------
/* An abstract class is a class that is declared abstract and may or may not include abstract methods. When an abstract class is subclassed, the subclass usually provides implementations for all the abstract metrods in the parent class. However, if it does not, then the subclass must also be declares abstract. */
//------------------
// Declare your class here. Do not use the 'public' access modifier.
class MyBook extends Book {
// Declare the price instance variable
int price;
/**
* Class Constructor
*
* @param title The book's title.
* @param author The book's author.
* @param price The book's price.
**/
// Write your constructor here
MyBook(String title, String author, int price){
super(title, author);
this.price = price;
}
/**
* Method Name: display
*
* Print the title, author, and price in the specified format.
**/
void display(){
System.out.println("Title: " + title);
System.out.println("Author: " + author);
System.out.println("Price: " + price);
}
// End class
}
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String title = scanner.nextLine();
String author = scanner.nextLine();
int price = scanner.nextInt();
scanner.close();
Book book = new MyBook(title, author, price);
book.display();
}
}