/* related posts with thumb nails */

Simulate the library information system i.e. maintain the list of books and borrower’s details.:

import java.io.*;

class Library

{

public static void main(String as[]) throws Exception

{

int i=0,x,m;

String con="";

int a[]=new int[10];

String name[]=new String[10];

String s[]={"Self Confidence ","My Experiments with truth",

"Java Apoorva book","Java Complete Reference"};

InputStreamReader isr=new InputStreamReader(System.in);

BufferedReader br=new BufferedReader(isr);

do

{

System.out.println("Select Books from the list:\n");

System.out.println(" 1.Self Confidence -book");

System.out.println(" 2.My Experiments with truth");

System.out.println(" 3.Java Apoorva book");

System.out.println(" 4.Java Complete Reference");

System.out.println("\nSelect the book number:");

x=Integer.parseInt(br.readLine());

if(x<1 || x>4) continue;

a[i]=x;

System.out.println("Enter your name:");

name[i]=br.readLine();

i++;

System.out.println("Continue?(y,n):");

con=br.readLine();

}while(con.equals("y"));

m=i; // number of borrowers

System.out.println("==========================================");

System.out.println("\nName \t Book borrowed");

System.out.println("=========================================");

for(i=0;i

{

System.out.println(name[i]+"\t"+s[a[i]]);

} System.out.println("==========================================");

}

}

/* Output: */

Select Books from the list:

1.Self Confidence -book

2.My Experiments with truth

3.Java Apoorva book

4.Java Complete Reference

Select the book number:2

Enter your name:Ravi

Continue?(y,n):y

Select Books from the list:

1.Self Confidence -book

2.My Experiments with truth

3.Java Apoorva book

4.Java Complete Reference

Select the book number:3

Enter your name:Kiran

Continue?(y,n):n

Related Topics:

0 comments:

Post a Comment