New course! Every coder should learn Generative AI!
Try a free lesson0
Please run this code and let me know why it is throwing an error
1 Answer
0
Change your methods like this.
public void discountedPrice()
{
double amount = price - (price*(discount/100));
System.out.println("Final price:"+amount);
}
public void displayDetails()
{
System.out.println("Isbn:"+isbn+"\nTitle:"+title+"\nAuthor:"+author+"\nOriginal price:"+price);
discountedPrice();
}