import java.*; import java.io.*; import java.util.*; class publication { int book_id; String title; String Author_name; int year; int price; int no_of_page; int cd_capacity; public static void main(String ards[]) { book obj = new book(); method obj1 = new method(); obj.getdata(); obj1.getdata(); obj.show_detail(); obj1.show_detail(); } } class book extends publication { void getdata() { Scanner sc = new Scanner(System.in); System.out.print("Enter Book ID : "); book_id = sc.nextInt(); sc.nextLine(); System.out.print("Enter Book Title : "); title = sc.nextLine(); System.out.print("Enter Book Author Name : "); Author_name = sc.nextLine(); System.out.print("Enter Book Year : "); year = sc.nextInt(); System.out.print("Enter Book Price : "); price = sc.nextInt(); } void show_detail() { System.out.println("\n\n\tBOOk ID : "+book_id); System.out.println("\tBOOk TITLE : "+title); System.out.println("\tBOOk AUTHOR : "+Author_name); System.out.println("\tBOOk YEAR : "+year); System.out.println("\tBOOk PRICE : "+price); } } class method extends pulication { void getdata() { Scanner sc = new Scanner(System.in); System.out.print("Enter Book Number of pages : "); no_of_page = sc.nextInt(); } void show_detail() { System.out.println("\n\n\tBOOK NUMBER OF PAGES : "+no_of_page); if(no_of_page >= 0 && no_of_page = 101 && no_of_page <= 200) { System.out.println("\tBOOK CD CAPACITY 20 MINITE"); } else { System.out.println("\tBOOK CD CAPACITY 30 MINITE"); } } }
INPUT
Enter Book ID : 101
Enter Book Title : Coin COllection
Enter Book Author Name : Pratik Badala
Enter Book Year : 2010
Enter Book Price : 300
Enter Book Number of Pages : 200
OUTPUT
Book ID : 101
Book Title : Coin Collection
Book Author Name : Pratik Badala
Book Year : 2010
Book Price : 300
Book Number of Pages : 200
BOOK CD CAPACITY 20 MINITE