-
Notifications
You must be signed in to change notification settings - Fork 0
/
QB 817.java
50 lines (37 loc) · 1.01 KB
/
QB 817.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// //QB 817
import java.util.Scanner;
class book {
String author_name;
void display() {
System.out.println("Author name is: " + author_name);
}
}
class book_publication extends book {
String title;
void display() {
System.out.println("Book name is: " + title);
}
}
class paper_publication extends book {
String title;
void display() {
System.out.println("Paper name is: " + title);
}
}
class data {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Author name: ");
book b1 = new book();
b1.author_name = sc.nextLine();
System.out.println("Enter Book name: ");
book_publication b2 = new book_publication();
b2.title = sc.nextLine();
System.out.println("Enter Paper name: ");
paper_publication b3 = new paper_publication();
b3.title = sc.nextLine();
b1.display();
b2.display();
b3.display();
}
}