-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimple_Library.java
More file actions
63 lines (49 loc) · 1.25 KB
/
Simple_Library.java
File metadata and controls
63 lines (49 loc) · 1.25 KB
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
62
63
public class Main {
publis
static void countBooks(String[] args) {
Library book1 = new Library("Book1", new Book[] { new Book("Miranda", "by George", 1234) });
}
class Book { // Preparing Book Class
private String title; // title (a String)
private String author; // author (a String)
private int ID; // int (ID)
public Book(String aTitle, String author, int id) {
this.title = aTitle;
this.author = author;
this.ID = id;
}
private String title;
public String getTitle() {
return title;
}
private String author;
public String getAuthor() {
return author;
}
private String ID;
public String getID() {
return ID;
}
public void print() {
System.out.println("Title of the book" + title);
System.out.println("Author of the book" + ID);
}
}
class Library {
public Library(int id_3, Book[] books) {
this.id_3 = id_3;
this.books = books;
}
private int id_3;
public int getID)
{
return books;
}
}
public static void main(String[] args) {
List<String> books = new BookName<>;
books.add("Marlyn");
books.add("Computer Science");
books.add("Gatsby");
System.out.println(books);
}