Added 25 solutions

This commit is contained in:
rshaghoulian
2017-02-24 00:24:47 -06:00
parent 05ce4b1476
commit af8c2969a4
50 changed files with 1562 additions and 277 deletions
@@ -0,0 +1,31 @@
// Author: Rodney Shaghoulian
// Github: github.com/rshaghoulian
// HackerRank: hackerrank.com/rshaghoulian
import java.util.*;
abstract class Book {
String title;
abstract void setTitle(String s);
String getTitle() {
return title;
}
}
class MyBook extends Book {
void setTitle(String s) {
title = s;
}
}
public class Main {
public static void main(String []args) {
//Book new_novel=new Book(); This line prHMain.java:25: error: Book is abstract; cannot be instantiated
Scanner sc = new Scanner(System.in);
String title = sc.nextLine();
MyBook new_novel = new MyBook();
new_novel.setTitle(title);
System.out.println("The title is: "+ new_novel.getTitle());
sc.close();
}
}