Posts

Showing posts from June, 2024

Product calculation

Image
 import java.util.Scanner; public class ProductDetails {     public static void main(String[] args) {         Scanner scanner = new Scanner(System.in);         // Prompt for product name         System.out.print("P-Name: ");         String productName = scanner.nextLine();         // Prompt for quantity         System.out.print("Qty: ");         int quantity = scanner.nextInt();         // Prompt for price         System.out.print("Price: ");         double price = scanner.nextDouble();         // Prompt for tax percentage         System.out.print("Tax (%): ");         double tax = scanner.nextDouble();         // Calculate tax amount         double taxAmount = (tax / 100) * pr...