更新时间:2023-12-04 09:43:40
你应该创建一个这样的类
这个类将描述每个产品属性的详细信息
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;
}
声明一个 ProductDetails 的数组
Declare an array of ProductDetails
ProductDetails[] pdr = new ProductDetails[n];
在此运行for循环
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();
// TODO your code to read the product details
return productDetails;
}
并将所有这些组合在一起
And assemble all this together