-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBook.java
41 lines (30 loc) · 1013 Bytes
/
Book.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
// Java Program to Illustrate book Class that
// takes Input from the books and related information
// Importing required classes
import java.util.Scanner;
// Class
// Class
public class Book {
// Class data members
public int sNo;
public String bookName;
public String authorName;
public int bookQty;
public int bookQtyCopy;
// Creating object of Scanner class to read input from users
Scanner input = new Scanner(System.in);
// Method to add book details
public Book() {
// Display message for taking input
System.out.println("Enter Serial No of Book:");
this.sNo = input.nextInt();
input.nextLine();
System.out.println("Enter Book Name:");
this.bookName = input.nextLine();
System.out.println("Enter Author Name:");
this.authorName = input.nextLine();
System.out.println("Enter Quantity of Books:");
this.bookQty = input.nextInt();
bookQtyCopy = this.bookQty;
}
}