-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlibrary.java
70 lines (61 loc) · 1.48 KB
/
library.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
62
63
64
65
66
67
68
69
70
package library;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Library {
public static void main(String[] args) {
Book b=new Book();
}
}
//Book Details
public class Book
{
String bk_name;
double price;
String author;
String availability;
Book(String bkn,double p,String author,String availability)
{
bk_name=bkn;
price=p;
this.author=author;
this.availability=availability;
}
//Librarian Log
void librarian(){
int it,rt,fine,n;
System.out.println("Enter the issue _date and return_date");
Scanner s= new Scanner(System.in);
it=s.nextInt();
rt=s.nextInt();
n=it-rt;
if(n>7)
{ fine=(n-7)*5;
System.out.println("The amount as fine is:"+fine);
}
else
System.out.println("No Fine");
}
void student()
{
String name,sclass;
int roll;
System.out.println("enter your name,class,roll no: ");
name=s.next();
sclass=s.next();
roll=s.nextInt();
List<String> list = new ArrayList<>();
list.add(new Book("oopm","Herbert",200,"YES"));
list.add(new Book("dbms","TECHMAX",300,"YES"));
list.add(new Book("dsa","TACHMAX",150,"YES"));
list.add(new Book("adc","TECHMAX",400,"YES"));
list.add(new Book("padc","TECHMAX",145,"YES"));
Scanner input=new Scanner(System.in);
System.out.println("Enter book name:");
String st=input.nextLine();
for (Book s : list){
if(st.equals(s.bk_name)){
System.out.println("\n book_name:"+bk_name +"\nAuthor:"+ author +"\n Price:"+ price +"\n Availability:"+availability);
} }
}
}