Hi, I am currently making an assignment for JAVA, but I get stuck at the following. I need to make a simulation of a shop where a customer puts objects in his "basket" and with that basket you go to the checkout counter. Now we have to make it possible that you can put objects that are created with the class article into an array list in the class basket with a method that is in the class person.
So we have a class person, basket, article and counter.
We already have a method in basket to add articles:
public void voegToe(Artikel artikel)
{
artikelen.add(artikel);
}
And in the class person we got the following code we must use to achieve this:
public void pakArtikel(Artikel artikel)
{
...
}
And the articles should be added to the following array:
private ArrayList<Artikel> artikelen;
So far we have tried to add object to the basket by using .add:Basket.artikelen.add(artikel)
This didn't work.
Then I tried calling the method:Basket.voegtoe()
But this didn't work either. Hopefully someone can help us with this, we have been looking for an answer for hours now.