-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrary.java
More file actions
35 lines (35 loc) · 1.15 KB
/
Library.java
File metadata and controls
35 lines (35 loc) · 1.15 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
import java.util.Scanner;
public class Library {
String bookName;
String authorName;
int bookId;
int quantity;
Library(String a, String b, int c, int d) {
this.bookName = a;
this.authorName = b;
this.bookId = c;
this.quantity = d;
}
void display() {
System.out.println("Book Name : " + bookName);
System.out.println("Author Name : " + authorName);
System.out.println("Book ID : " + bookId);
System.out.println("Quantity : " + quantity);
}
public static void main(String[] args) {
Scanner S = new Scanner(System.in);
System.out.println("Enter Library Book Details");
System.out.print("Enter Book Name : ");
String a = S.nextLine();
System.out.print("Enter Author Name : ");
String b = S.nextLine();
System.out.print("Enter Book ID : ");
int c = S.nextInt();
System.out.print("Enter Quantity : ");
int d = S.nextInt();
Library lb = new Library(a, b, c, d);
System.out.println("Library Book Details: ");
lb.display();
S.close();
}
}