Posts

Showing posts from June, 2024

Program

Image
 import java.util.Scanner; class Product {     String name;     int quantity;     double price;     double tax;     // Constructor     public Product(String name, int quantity, double price, double tax) {         this.name = name;         this.quantity = quantity;         this.price = price;         this.tax = tax;     }     // Method to calculate the total amount     public double calculateTotalAmount() {         double totalPrice = price * quantity;         double totalTax = totalPrice * (tax / 100);         return totalPrice + totalTax;     } } public class ProductCalculation {     public static void main(String[] args) {         Scanner scanner = new Scanner(System.in);         // Taking input...