mirror of
https://github.com/Dichgrem/Java.git
synced 2025-12-17 04:51:58 -05:00
update:demo4
This commit is contained in:
11
com/study/demo4/BikeDeliveryCalculator.java
Normal file
11
com/study/demo4/BikeDeliveryCalculator.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.study.demo4;
|
||||
|
||||
class BikeDeliveryCalculator implements DeliveryFeeCalculator {
|
||||
@Override
|
||||
public double calculateFee(double distance) {
|
||||
if (distance <= 5) {
|
||||
return 5.0; // 起步价
|
||||
}
|
||||
return 5.0 + (distance - 5) * 1.5;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user