2017-09-18 09:16:14 -07:00
|
|
|
// Author: Rodney Shaghoulian
|
2018-07-27 16:45:56 -07:00
|
|
|
// Github: github.com/RodneyShag
|
|
|
|
|
// HackerRank: hackerrank.com/RodneyShag
|
2017-09-18 09:16:14 -07:00
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
abstract class Book {
|
|
|
|
|
String title;
|
|
|
|
|
String author;
|
|
|
|
|
Book(String t, String a) {
|
|
|
|
|
title = t;
|
|
|
|
|
author = a;
|
|
|
|
|
}
|
|
|
|
|
abstract void display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class MyBook extends Book {
|
|
|
|
|
int price;
|
|
|
|
|
|
|
|
|
|
MyBook(String title, String author, int price) {
|
|
|
|
|
super(title, author);
|
|
|
|
|
this.price = price;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void display() {
|
|
|
|
|
System.out.println("Title: " + title);
|
|
|
|
|
System.out.println("Author: " + author);
|
|
|
|
|
System.out.println("Price: " + price);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Solution {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
Scanner sc = new Scanner(System.in);
|
|
|
|
|
String title = sc.nextLine();
|
|
|
|
|
String author = sc.nextLine();
|
|
|
|
|
int price = sc.nextInt();
|
|
|
|
|
Book new_novel = new MyBook(title, author, price);
|
|
|
|
|
new_novel.display();
|
|
|
|
|
}
|
|
|
|
|
}
|