Есть ошибки на всех, имеющих отношение к цене/Ошибка BigDecimal в Java
import java.math.BigDecimal;
общественного класса продукта {
// Fields
String name;
String description;
BigDecimal price = new BigDecimal(3.0);
int quantity;
String barcode;
String image;
static int count;
// Constructors
public Product()
{
name = "";
description = "";
price = 0;
quantity = 0;
barcode = "";
image = "";
}
public Product(String n, String d, double p, int q, String b, String i)
{
name = n;
description = d;
price = p;
quantity = q;
barcode = b;
image = i;
}
// Get/Set methods
// description getter and setter
public String getDescription()
{
return description;
}
public void setDescription(String d)
{
this.description = d;
}
// name getter and setter
public String getName()
{
return name;
}
public void setName(String d)
{
this.name = d;
}
// price getter and setter
public double getPrice()
{
return price;
}
public void setPrice(double d)
{
this.price = d;
}
// quantity getter and setter
public int getQuantity()
{
return quantity;
}
public void setQuantity(int d)
{
this.quantity = d;
}
// barcode getter and setter
public String getBarcode()
{
return barcode;
}
public void setBarcode(String d)
{
this.barcode = d;
}
// image getter and setter
public String getImage()
{
return image;
}
public void setImage(String d)
{
this.image = d;
}
}
Мои вопросы почему есть ошибка для всех моих цен частей. Мне нужно, чтобы это было большое десятичное число, но как исправить ошибки?
Спасибо, что сообщили нам об ошибках. –
, пожалуйста, правильно отформатируйте свой код! – isnot2bad
вы не объяснили, в чем ошибки, где, как вы их получили, и то, что вы ожидали, вместо этого. – tucuxi