-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gestion du bagage: chaque voyageur peut bénéficier d'un bagage gratui…
…t de 10Kg Max, chaque point supllémrantaire et payé au Kg
- Loading branch information
e.elhjoujy
committed
Oct 25, 2023
1 parent
d53681a
commit 5611bff
Showing
5 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package ma.yc.airafraik.service; | ||
|
||
|
||
public interface BagageService { | ||
public double calculerPrixBagage(double poids); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/ma/yc/airafraik/service/impl/BagageServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package ma.yc.airafraik.service.impl; | ||
|
||
import ma.yc.airafraik.service.BagageService; | ||
|
||
public class BagageServiceImpl implements BagageService { | ||
@Override | ||
public double calculerPrixBagage(double poids) { | ||
double prix = 0; | ||
|
||
if (poids <= 10) { | ||
prix = poids * 25; // Chaque 1 KG vaut 25 Euros | ||
} else if (poids > 10 && poids <= 15) { | ||
prix = 10 * 25 + (poids - 10) * 18; // Au-delà de 10 Kg, 1 KG vaut 18 Euros | ||
} else { | ||
prix = 10 * 25 + 5 * 18 + (poids - 15) * 18; // Au-delà de 15 Kg, 1 KG vaut toujours 18 Euros | ||
} | ||
|
||
return prix; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters