Posts

Showing posts from September, 2024

Blog's

1. R.Mathavan P23CS386 Blog 1 Blog 2 Blog 3 Blog 4 2.M.Nikkirtha P23CS387 Blog 1 Blog 2 Blog 3 Blog 4 3.K.Nivedha P23CS388 Blog 1 Blog 2 Blog 3 Blog 4 4. G.Nivetha P23CS389 Blog 1 Blog 2 Blog 3 Blog 4 5. M.PooJaa P23CS390 Blog 1 Blog 2 Blog 3 Blog 4 6.P.Prabha P23CS391 Blog 1 Blog 2 Blog 3 Blog 4 7.T.P.Praghadheesh P23CS392 Blog 1 Blog 2 Blog 3 Blog 4 8.R.Rajeshwari P23CS393 Blog 1 Blog 2 Blog 3 Blog 4 9. R.Ramya P23CS394 Blog 1 Blog 2 Blog 3 Blog 4 10.S.Sharmila P23CS395 Blog 1 Blog 2 Blog 3 Blog 4 11. D.Sobiya P23CS396 Blog 1 Blog 2 Blog 3 Blog 4 12.C.Swathi P23CS397 Blog 1 Blog 2 Blog 3 Blog 4 13.V.Vignesh P23CS398 Blog 1 Blog 2 Blog 3 Blog 4 14. R.VishnuPriya P23CS399 Blog 1 Blog 2 Blog 3 Blog 4 15. M.K.Yuvarani P23CS400 Blog 1 Blog 2 Blog 3 Blog 4

Product calculation

Program // Define the Product class class Product {     private String name;     private double price;     private int quantity;     private double taxRate; // Tax rate as a decimal (e.g., 0.08 for 8%)     // Constructor to initialize the product     public Product(String name, double price, int quantity, double taxRate) {         this.name = name;         this.price = price;         this.quantity = quantity;         this.taxRate = taxRate;     }     // Method to calculate the total cost including tax     public double calculateTotalCost() {         double subtotal = price * quantity;         double taxAmount = subtotal * taxRate;         double totalCost = subtotal + taxAmount;         return totalCost;     }     // Gett...