Suppose that a class is defined to represent a deck of cards or a player's hand in a card game. This class is implemented as below: A class, also, is defined to develop a card game in which a list of all players' names and their hand is stored. Part of the implementation of this class looks like the following code: A) Specify what should be the return type of getPlayersHand()? B) Assume that the cardGame is a composition of Deck. With this assumption, i) implemnt getPlayerHand(). ii) implement the overloaded constructor of Deck. No java methods can be used for part ii. C) Assume that cardGame is an aggregation of Deck. With this assumption, implement getPalyerHand(). D) An equals() method has been implemented for Deck class. Fill in the gaps to create a fully working equals() method.
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
Suppose that a class is defined to represent a deck of cards or a player's hand in a card game. This class is implemented as below:
A class, also, is defined to develop a card game in which a list of all players' names and their hand is stored. Part of the implementation of this class looks like the following code:
A) Specify what should be the return type of getPlayersHand()?
B) Assume that the cardGame is a composition of Deck. With this assumption, i) implemnt getPlayerHand(). ii) implement the overloaded constructor of Deck. No java methods can be used for part ii.
C) Assume that cardGame is an aggregation of Deck. With this assumption, implement getPalyerHand().
D) An equals() method has been implemented for Deck class. Fill in the gaps to create a fully working equals() method.
Step by step
Solved in 2 steps