You should create a class like this
This class will describe the details of the property of each product
class ProductDetails {
public String idNo;
public String description;
public double cost;
public double price;
public int Quantity;
}
Declare an array of
ProductDetails
ProductDetails[] pdr = new ProductDetails[n];
Run the for loop on this
for(int i=0;i<n;i++) {
pdr[i]=readEachProductDetails();
}
You also need to define
read_each_product_details
ProductDetails readEachProductDetails () {
ProductDetails productDetails = new ProductDetails();
return productDetails;
}
And assemble all this together