You should use,
Guest g = new Guest("Alice",new Tea("RoseShip Tea",false,true),new Cake("Chocolate Sponge"));
table.addGuest(g);
instead of
guests[0]=table.addGuest("Alice",new Tea("RoseShip Tea",false,true),new Cake("Chocolate Sponge"));
because you pass the arguments required for the constructor of Guest to the wrong method(addGuest(<Guest>)
), which requires the actual Guest-object.
EDIT
Further, this will also not work
guests[0]=table.addGuest(...);
because table.addGuest(...)
is of type void
, so it wont return anything, so you will get an compiler error.
I recommend rethink the use of guests[]
, you could probably use a collection (like LinkedList
or ArrayList
) to solve this problem.