I have two example of code. The first has the following classes. ReservationMain, Menu, Controller, Console and Reservation. In the ReservationMain it has the following
Controller controller = new Controller(); - here we instatiated a class but then in the next line of code we do this.
Menu gui=new Menu(controller) - what is this exactly doing? What is the thought process of this?
the second example has two classes DeckOfCards and
Cards
DeckOfCards has private Card card;
deckOfCards = card.create;
in Card we have the following
public Card(Rank rank, Suit suit)
{
this.rank = rank;
this.suit = suit;
}
public ArrayList<Card> create()
{
for (Suit suit :Suit.values())
{
for (Rank rank : Rank.values())
{
deck.add (new Card(rank, suit));
}
}
return deck;
}