Этот валидатор прям выбешивает. Да, понимаю, что далеко зашел и может перегнул палку с решением данной задачи, но интересен именно данный вариант решения.
package com.javarush.task.task18.task1822;
public class Product {
private String productName;
private double price;
private int quantity;
public Product(String productName, double price, int quantity) {
this.productName = productName;
this.price = price;
this.quantity = quantity;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
@Override
public String toString() {
return productName + " " + price + " " + quantity;
}
}