📅  最后修改于: 2023-12-03 15:36:49.076000             🧑  作者: Mango
农药漂移是指在农业生产中使用的农药从目标植物或土地漂移到其他地方或者空气中的现象。农药漂移是一种环境污染,对人畜水产等生命有害。
// 定义农药类
class Pesticide {
String name;
double amount;
Pesticide(name, amount) {
this.name = name;
this.amount = amount;
}
// 预防农药漂移
void preventDrift() {
// 设定防护装备
wearProtectiveEquipment();
// 适量使用农药
useProperAmount();
// 根据天气、风速等信息进行农药施放
useScientificWay();
}
// 防护装备
void wearProtectiveEquipment() {
print('Wear a mask, gloves and protective clothing');
}
// 适量使用农药
void useProperAmount() {
if (amount > 5) {
print('Use proper amount');
} else {
print('Do not use, try other solutions');
}
}
// 科学施放农药
void useScientificWay() {
print('Use according to weather and wind speed');
}
}
// 定义检测中心类
class DetectionCenter {
static const criticalValue = 10;
// 检测农作物
void detectCrop(Pesticide pesticide, crop) {
double residue = pesticide.amount / crop;
if (residue > criticalValue) {
print('The crop contains too much pesticide residue');
cleanUp(residue);
} else {
print('The crop is safe');
}
}
// 清理污染
void cleanUp(double residue) {
print('Clean up the land or water');
}
}
void main() {
var pesticide = new Pesticide('DDT', 12.0);
pesticide.preventDrift();
var detectionCenter = new DetectionCenter();
detectionCenter.detectCrop(pesticide, 10.0);
}