18 Project On Library Management
18 Project On Library Management
*; class Record { String title; String author; String subject; public int no; Record(String t,String a,String s,int n) { title=t; author=a; subject=s; no=n; } void show() { System.out.println(); System.out.println("Title : "+title); System.out.println("Author Name : "+author); System.out.println("Subject : "+subject); System.out.println("No. of books : "+no); } void display() { System.out.println("Book Name :"+title); System.out.println("Author Name :"+author); System.out.println("Subject :"+subject); System.out.println("No of book :"+no); } }
class lib_mngt { public static void main(String args[]) { Record obj[]=new Record[20]; int i,j; int ch=0; int temp=0; int g=0; String s=""; int y=0; int np=0; DataInputStream d=new DataInputStream(System.in); obj[0]=new obj[1]=new obj[2]=new obj[3]=new obj[4]=new obj[5]=new obj[6]=new Shell",25); Record("Java","Balguru","Java Pro",25); Record("OS","Galvin","Process",25); Record("AMP","AK Ray","Microprocessor",25); Record("NM","Zacker","Network",25); Record("CS","Fliger","Security",25); Record("SE","Presman","Software Engg",25); Record("Operating Sys","Yashwant","Unix
obj[7]=new Record("IBM-PC","Peter Abel","Assembly Lang",25); obj[8]=new Record("MS. DOS","Ray Duncan ","Programming",25); obj[9]=new Record("Principles of CS","Chuck","Computer Security",25); obj[10]=new Record("Security Principles","William","Cryptography",25); obj[11]=new Record("OOP","C Thomas","OO Programng",25); obj[12]=new Record("Java","Cohoon","Program design",25); obj[13]=new Record("Unix Concepts and Programming","Murugan Sethuraman","Unix Pro",25); obj[14]=new Record("Software Engineering Principles and Practice","Waman S. Jawadekar ","Engineering Principles",25); obj[15]=new Record("Java2 Programming","Keyur Shah ","java",25); obj[16]=new Record("Computer Security Basics","G.T.Gangenisr ","Security Basics",25); obj[17]=new Record("Auto Car India","Times","Car",25); 2
obj[18]=new Record("Elec for You","E","Electronics",25); obj[19]=new Record("Witch of Portobello","Paulo Ceolho","Novel",25); do { System.out.println("\t\t\t\t\tBook Details"); System.out.println("---------------------------------------------------------------------------------------------------\n"); for(i=0;i<20;i++) { obj[i].show(); } try { System.out.println("---------------------------------------------------------------------------------------------------\n"); System.out.print("Enter the Title / Author / Subject name to search :"); s=d.readLine(); }//end of try catch(Exception e) { System.out.println("I/O Error"); }//end of catch System.out.println(); System.out.println(s+" : Book Details");
temp=i; np=i; g=1; break; }//end of if else { g=0; } }//end of for switch(g) { case 1: try { System.out.println(); System.out.print("Press 1 to Issue & 2 to Submit the book:"); ch=Integer.parseInt(d.readLine()); } catch(Exception e) { } int q=np; j=temp; if(ch==1) { if(obj[j].no<=0) System.out.println("You can't issue"); else obj[j].no--; obj[j].display();
} else { obj[i].no++; obj[j].display(); } } else System.out.println("Invalid Entery"); break; case 0: System.out.println("No Record Found"); break; }//end of switch; try { System.out.println(); System.out.print("Press 5 to continue : "); y=Integer.parseInt(d.readLine()); } catch(Exception e) { System.out.println("I/O Error"); } }while(y==5); }//end of main }//end of class
Book Search