Computers and Technology

The grid of equal-sized plots is represented by a two-dimensional array of Plot objects named farmPlots, declared in the ExperimentalFarm class. A partial definition of the ExperimentalFarm class is shown below. public class ExperimentalFarm
{
private Plot[][] farmPlots;
public ExperimentalFarm(Plot[][] p)
{
/* implementation not shown */
}
/** Returns the plot with the highest yield for a given crop type, as described in part (a). */
public Plot getHighestYield(String c)
{
/* to be implemented in part (a) */
}
/** Returns true if all plots in a given column in the two-dimensional array farmPlots
* contain the same type of crop, or false otherwise, as described in part (b).
*/
public boolean sameCrop(int col)
{
/* to be implemented in part (b) */
}
}
(a) Write the getHighestYield method, which returns the Plot object with the highest yield among the plots in farmPlots with the crop type specified by the parameter c. If more than one plot has the highest yield, any of these plots may be returned. If no plot exists containing the specified type of crop, the method returns null.
Assume that the ExperimentalFarm object f has been created such that its farmPlots array contains the following cropType and cropYield values.
The following are some examples of the behavior of the getHighestYield method.
Method Call Return Value
f. getHighestYield("corn") farmPlots[1][3]
f. getHighestYield("peas") farmPlots[1][0] or farmPlots[3][2]
f. getHighestYield("bananas") null

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 01:50, jumoke26
Create a class named majors that includes an enumeration for the six majors offered by a college as follows: acc, chem, cis, eng, his, phys. display the enumeration values for the user, then prompt the user to enter a major. display the college division in which the major falls. acc and cis are in the business division, chem and phys are in the science division, and eng and his are in the humanities division. save the file as majors. java.
Answers: 2
image
Computers and Technology, 23.06.2019 22:00, rocksquad9125
Take a critical look at three gui applications you have used—for example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
image
Computers and Technology, 24.06.2019 11:40, girdwood6678
100 pts. first person gets brainliest
Answers: 2
image
Computers and Technology, 24.06.2019 13:00, brusawerin5969
Refer to the figure and match the theorem that supports the statement.1.if chords are =, then arcs are =.if bc = de, then arc bc = arc de2.if arcs are =, then chords are =.if arc bc = arc de, then bc = de3.diameters perpen
Answers: 3
Do you know the correct answer?
The grid of equal-sized plots is represented by a two-dimensional array of Plot objects named farmPl...

Questions in other subjects: