补全代码package step1; public class Client { public static void main(String[] args) { CucumberCrop cucumberCrop=new CucumberCrop("黄瓜实验田1"); CauliflowerCrop cauliflowerCrop = new CauliflowerCrop("花菜实验田2"); TomatoCrop tomatoCrop = new TomatoCrop("番茄实验田3"); CropGroup cropgroup = new CropGroup(); cropgroup.addCrop(cucumberCrop); cropgroup.addCrop(cauliflowerCrop); cropgroup.addCrop(tomatoCrop); CropVisitor visitor = new GrowthVisitors(); cropgroup.accept(visitor); /********** Begin *********/ /********** End *********/ } }
时间: 2023-06-29 10:14:58 浏览: 116
请补全代码如下:
```
package step1;
public class Client {
public static void main(String[] args) {
CucumberCrop cucumberCrop = new CucumberCrop("黄瓜实验田1");
CauliflowerCrop cauliflowerCrop = new CauliflowerCrop("花菜实验田2");
TomatoCrop tomatoCrop = new TomatoCrop("番茄实验田3");
CropGroup cropgroup = new CropGroup();
cropgroup.addCrop(cucumberCrop);
cropgroup.addCrop(cauliflowerCrop);
cropgroup.addCrop(tomatoCrop);
CropVisitor visitor = new GrowthVisitors();
cropgroup.accept(visitor);
CropVisitor pestVisitor = new PestsVisitors();
cropgroup.accept(pestVisitor);
}
}
```
阅读全文