Ajout du lancement d'exception d'argument invalide si le ticket passé n'est pas pris en charge
This commit is contained in:
parent
45e760fcac
commit
20d1b4dd03
1 changed files with 4 additions and 0 deletions
|
|
@ -3,6 +3,10 @@ package org.example;
|
||||||
public class FeeCalculator {
|
public class FeeCalculator {
|
||||||
|
|
||||||
public static double calculateFee(Visitor visitor, TicketType ticketType) {
|
public static double calculateFee(Visitor visitor, TicketType ticketType) {
|
||||||
|
if (TicketType.HALF_DAY != ticketType && TicketType.FULL_DAY != ticketType) {
|
||||||
|
throw new IllegalArgumentException("Invalid ticket type");
|
||||||
|
}
|
||||||
|
|
||||||
double fee = visitor.calculateFee(ticketType);
|
double fee = visitor.calculateFee(ticketType);
|
||||||
return fee;
|
return fee;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue