-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBookDetails.java
61 lines (51 loc) · 1.1 KB
/
BookDetails.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
51
52
53
54
55
56
57
58
59
60
61
//Program to implement a Book class that stores the details of a book such as its code, title and price (Use constructors to initialize the objects).
import java.util.*;
class BookDetails
{
public String title;
public String isbnnumber;
public double price;
public BookDetails(String t,String n,double p)
{
title=t.trim();
isbnnumber=n.trim();
price=p;
}
public void getTitle()
{
System.out.print("\nTitle of Book: " + title);
}
public void getIsbnnumber()
{
System.out.print("\nISBN number of Book: " + isbnnumber);
}
public void getPrice()
{
System.out.print("\nPrice of Book: " + price);
}
public void setTitle()
{
this.title = title;
}
public void setISBNnumber(String isbnnumber)
{
this.isbnnumber = isbnnumber;
}
public void setCost(int price)
{
this.price=price;
}
public void show()
{
getTitle();
getIsbnnumber();
getPrice();
}
public static void main(String args[])
{
BookDetails b1 = new BookDetails("Machine Learning", "IBN20000", 500.00);
b1.show();
BookDetails b2 = new BookDetails("Python Programmimg", "ISBN2018", 475.00);
b2.show();
}
}