HOME

HOME

Library management system

 package com.company;

import java.util.Scanner;
class library{
String [] array= new String[1000];
String [] aray= new String[1000];
Scanner s=new Scanner(System.in);
int i,b;
int g;
int h=6;
public void returnbook(){
int v;
System.out.println("enter the name of Book");
for(i=0; i <= h; i++){
if(array[i]==null){
array[this.g]=s.nextLine();
}
}
}
void addbook() {
int n = 5;
for (i = 0; i <= n; i++) {
System.out.println("enter the name of the book");
array[i] = s.nextLine();
}
}

void issuebook() {
int n = 0;
int c = 0;
for (i = 0; i <= n; i++) {
System.out.println("enter the number of the book you want ot issue");
int d = s.nextInt();
c = d - 1;
aray[i] = array[c];
System.out.println("book registered");
array[c]=null;
}
g = c;
for (i=0;i<6;i++){
if(array[i]==null){
array[i]=array[i+1];
array[i+1]=null;
}
}
}
void issuedbooks(){
System.out.println("\n Issued books are");
for (i = 0; i <= b; i++) {
System.out.println((i+1) +"-"+ aray[i]);
}
}
void avialablebooks(){
System.out.println("\n Avialable books are");
for (i = 0; i <= 5; i++) {
if (array[i]==null){
this.g=i;
break;
}
System.out.println((i+1) +"-"+ array[i]);
}
}
}
public class OnlineLibrraryManagement extends library {
public static void main(String[] args) {
library l=new library();
l.addbook();
l.avialablebooks();
l.issuebook();
l.issuedbooks();
l.avialablebooks();
l.returnbook();
l.avialablebooks();
}
}

No comments:

Post a Comment