Input Format
You are not responsible for reading any input from stdin. The Solution class creates a Book object and calls the MyBook class constructor (passing it the necessary arguments). It then calls the display method on the Book object.
Output Format
The  method should print and label the respective , and  of the MyBook object's instance (with each value on its own line) like so:
Abstract Classes problem solution 30 days of code HackerRank

Problem solution in Java programming language.

class MyBook extends Book {
    int price;
    
    /**   
    *   Class Constructor
    *   
    *   @param title The book's title.
    *   @param author The book's author.
    *   @param price The book's price.
    **/
    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.
    **/
    public void display(){
        System.out.println(
                "Title: " + this.title + "\n"
            +   "Author: " + this.author + "\n"
            +   "Price: " + this.price
        );
    }
}

Problem solution in JavaScript programming language.

class MyBook extends Book {
    
    constructor(title, author, price) {
        super(title, author)
        this.price = price
    }
    
    display() {
        console.log(
            'Title: ' + this.title + '\n' +
            'Author: ' + this.author + '\n' +
            'Price: ' + this.price
        )
    }
}

Problem solution in Ruby programming language.

## Head Code ## 
class Book
    attr_accessor :title
 attr_accessor :author
 
 def initialize(title, author)
  raise 'You cannot instantiate an abstract class.'
 end
 
 def display
  raise 'You must override this method in your implementing class.'
 end
end

class MyBook < Book
 attr_accessor :price

    ## Solution Code ##
    #   Class Constructor
 #   
 #   Parameters:
 #   title - The book's title.
 #   author - The book's author.
 #   price - The book's price.
 def initialize(title, author, price)
  @title = title
  @author = author
  @price = price
 end
 
 #   Function Name: display
 #   Print the title, author, and price in the specified format.
 #
 def display()
     print("Title: ", self.title, "Author: ", self.author, "Price: ", self.price)
 end
end

## Tail Code ##

title = gets
author = gets
price = gets

new_novel = MyBook.new(title, author, price)
new_novel.display    

Problem solution in Python programming language.

from abc import ABCMeta, abstractmethod
class Book(object, metaclass=ABCMeta):
    def __init__(self,title,author):
        self.title=title
        self.author=author   
    @abstractmethod
    def display(): pass

#Write MyBook class

class MyBook(Book):

    def __init__(self,title,author,price):
        self.title = title
        self.author = author
        self.price = price

    def display(self):
        print("Title:", title)
        print("Author:", author)
        print("Price:",price)

title=input()
author=input()
price=int(input())
new_novel=MyBook(title,author,price)
new_novel.display()