Question: public boolean addPlant(String plantName, int row) Adds plant (based on the five options) to designated row. If plant needs meet row conditions, the plant will
public boolean addPlant(String plantName, int row)
Adds plant (based on the five options) to designated row. If plant needs meet row conditions, the plant will be added. If not, then the plant will not be added to the row.
Returns:
true if plant was successfully added, false if unsuccessful
Code given:
public boolean addPlant(String plantName, int row) { if(canPlant(plantName, searchRow(row))){ searchRow(row).setPlant(searchPlant(plantName)); System.out.println(plantName.toUpperCase() + " added to row " + row + "!"); return true; } else{ System.out.println(plantName.toUpperCase() + " was unable to be planted."); return false; } } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
