-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbookinfo.java
More file actions
44 lines (43 loc) · 817 Bytes
/
bookinfo.java
File metadata and controls
44 lines (43 loc) · 817 Bytes
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
class Book
{
String author;
String title;
String publisher;
Book(String a, String t, String p)
{
author=a;
title=t;
publisher=p;
}
}
class BookInfo extends Book
{
private int price;
int stockposition;
BookInfo(String a, String t, String p, int r, int s)
{
super(a,t,p);
price=r;
stockposition=s;
}
public void show()
{
System.out.println("Book author is:"+author);
System.out.println("Book title is" +title);
System.out.println("Book publisher name is"+publisher);
System.out.println("Book price is"+price);
System.out.println("Book stockposition is:"+stockposition);
}
}
class MainBook
{
public static void main(String args[])
{
BookInfo B1=new BookInfo("abc", "a", "b", 100,1);
BookInfo B2=new BookInfo("ppp", "s", "d",200,3);
BookInfo B3=new BookInfo("pqr", "p", "q", 300,5);
B1.show();
B2.show();
B3.show();
}
}