0% found this document useful (0 votes)
18 views2 pages

Book Java Java

The document contains a Java program that defines a 'book' class with attributes for title, author, and price. It includes methods to accept book details from user input and display them. The 'Library' class contains the main method to execute the program, prompting the user for book information and displaying it afterward.

Uploaded by

Sonu Jadhav
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Book Java Java

The document contains a Java program that defines a 'book' class with attributes for title, author, and price. It includes methods to accept book details from user input and display them. The 'Library' class contains the main method to execute the program, prompting the user for book information and displaying it afterward.

Uploaded by

Sonu Jadhav
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Generated by: Java Viewer

package book14;
import [Link];

public class book {


String title;
String auther;
double price;

void acceptdetails(){
Scanner sc =new Scanner([Link]);
[Link]("Enter Book Title : ");
title=[Link]();

[Link]("Enter Auther Name : ");


auther=[Link]();

[Link]("Enter Book Price : ");


price=[Link]();
}
void displaytotal(){
[Link]("\n---book details---");
[Link]("title:"+title);
[Link]("auther:"+auther);
[Link]("price:"+price);
}

}
class Library{
public static void main(String[] args){
book summary =new book();
[Link]();
[Link]();

}
}
~ Output

Enter Book Title : Harry Potter and Half Blood Prince.


Enter Auther Name : J.K. Rowling .
Enter Book Price : 5499.

You might also like