update:demo4

This commit is contained in:
dichgrem
2025-11-28 16:59:17 +08:00
parent 41e6b71bd7
commit 5832b4fe9d
34 changed files with 307 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
package com.study.demo4;
class CarDeliveryCalculator implements DeliveryFeeCalculator {
@Override
public double calculateFee(double distance) {
if (distance <= 5) {
return 10.0; // 起步价
}
return 10.0 + (distance - 5) * 2.0;
}
}