Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Book {
- public String title;
- public String author;
- public double price;
- public Book(String title, String author, double price){
- this.title = title;
- this.author = author;
- this.price = price;
- }
- public double applyDiscount(double discount){
- return price - (price*discount/100);
- }
- public void displayBook(){
- System.out.println("The title of the book is : " + title);
- System.out.println("The author of the book is : " + author);
- System.out.println("The price of the book is : " + price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement