Tuesday 28 June 2016

Hackerrank , 30 Days of Code Challenges ( Day 13 - 15 Solutions)

Day 13: Abstract Classes   :
 
//Write MyBook Class
class MyBook extends Book
    {
    int price;
    MyBook(String t , String a , int p)
        {
        super(t,a);
        this.price =p;
    }
    void display()
        {
        System.out.println("Title: "+title);
        System.out.println("Author: "+author);
        System.out.println("Price: "+price);
    }
}

Day 14: Scope   :

    # Add your code here
    def computeDifference(self):
        self.maximumDifference =  max(a)-min(a)


Day 15: Linked List   :
 class MyBook extends Book
    {
    int price;
    MyBook(String t , String a , int p)
        {
        super(t,a);
        this.price =p;
    }
    void display()
        {
        System.out.println("Title: "+title);
        System.out.println("Author: "+author);
        System.out.println("Price: "+price);
    }
}

No comments:

Post a Comment