public Book(string title, string author, double price)
public void DisplayBookInfo()
Console.WriteLine("Title: " + title);
Console.WriteLine("Author: " + author);
Console.WriteLine("Price: $" + price);
public double CalculateDiscountedPrice(double discountPercentage)
double discountedPrice = price - (price * (discountPercentage / 100));
static void Main(string[] args)
Book book1 = new Book("The Great Gatsby", "F. Scott Fitzgerald", 15.99);
Book book2 = new Book("To Kill a Mockingbird", "Harper Lee", 12.99);
double discountPercentage = 10;
double book1DiscountedPrice = book1.CalculateDiscountedPrice(discountPercentage);
double book2DiscountedPrice = book2.CalculateDiscountedPrice(discountPercentage);
Console.WriteLine("Discounted Price for Book 1: $" + book1DiscountedPrice);
Console.WriteLine("Discounted Price for Book 2: $" + book2DiscountedPrice);