0% found this document useful (0 votes)
7 views1 page

Product 1

The document defines a Java class named Product1 that represents a store item with attributes such as name, product number, price, and quantity. It includes a constructor for initializing these attributes and getter methods for accessing their values. Additionally, it overrides the toString method to provide a formatted string representation of the product details.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Product 1

The document defines a Java class named Product1 that represents a store item with attributes such as name, product number, price, and quantity. It includes a constructor for initializing these attributes and getter methods for accessing their values. Additionally, it overrides the toString method to provide a formatted string representation of the product details.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

/**

* Represents a single store item with details such as name, product number, price,
and quantity.
*
* Aksh Ladegaonkar
* APR 12, 2025
*/
public class Product1 {
private String name;
private int productNumber;
private double price;
private int quantity;

public Product1(String name, int productNumber, double price, int quantity) {


this.name = name;
this.productNumber = productNumber;
this.price = price;
this.quantity = quantity;
}

public String getName() {


return name;
}
public int getProductNumber() {
return productNumber;
}
public double getPrice() {
return price;
}
public int getQuantity() {
return quantity;
}

public String toString() {


return String.format("%-15s%-12d$%-12.2f%d", name, productNumber, price,
quantity);
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy