Untitled

mail@pastecode.io avatar
unknown
plain_text
18 days ago
847 B
3
Indexable
Never
public class Product {
    private int productId;
    private String productName;
    private String productCategory;
    private double price;

    public Product(int productId, String productName, String productCategory, double price) {
        this.productId = productId;
        this.productName = productName;
        this.productCategory = productCategory;
        this.price = price;
    }

    // Getters and setters
    public int getProductId() { return productId; }
    public String getProductName() { return productName; }
    public String getProductCategory() { return productCategory; }
    public double getPrice() { return price; }

    @Override
    public String toString() {
        return "Product ID: " + productId + ", Name: " + productName + 
               ", Category: " + productCategory + ", Price: $" + price;
    }
}
Leave a Comment