So I have this
public class Client {
private String name;
private List<Product> purchase = new ArrayList<Product>();
Client (){}
Client (String name, List<Product> purchase ){
this.name = name;
this.purchase = purchase;
}
}
and in Main I want to create a new client and put it in database.
public class Main {
public static void main(String[] args) {
InterDao daoProduct = new ProductDAOImpl();
Product product1 = new Product(12,"waffle","2017-05-03",5);
Product product2 = new Product (5,"fff","2017-05-08",7);
List<Product> products = new ArrayList<Product>();
products.add(product1);
products.add(product2);
daoProduct.create(product1);
InterDao daoClient = new ClientDAOImpl();
Client client1 = new Client("John", product1);
daoClient.create(client1);
}
}
Obviously,
Client client1 = new Client("John", product1);
does not work. I have tried so many ways of calling a specific product but none of them worked. Please give me some ideas.
This gives me this error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem: The constructor Client(String, Product) is undefined