Created
September 8, 2020 05:32
-
-
Save ssukhpinder/daf7fc8aae675ebfa289e289faeceb56 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public static int OccupancyTypeTollFare(Object vehicleType) => vehicleType switch | |
{ | |
Car { PassengerCount: 0 } => 100 + 10, | |
Car { PassengerCount: 1 } => 100, | |
Car { PassengerCount: 2 } => 100 - 10, | |
Car c => 100 - 20, | |
Taxi { Fare: 0 } => 100 + 10, | |
Taxi { Fare: 1 } => 100, | |
Taxi { Fare: 2 } => 100 - 10, | |
Taxi t => 100 - 20, | |
Bus b when ((double)b.RidersCount / (double)b.Capacity) < 0.50 => 150 + 30, | |
Bus b when ((double)b.RidersCount / (double)b.Capacity) > 0.90 => 150 - 40, | |
Bus b => 150, | |
DeliveryTruck t when (t.Weight > 5000) => 200 + 100, | |
DeliveryTruck t when (t.Weight < 3000) => 200 - 20, | |
DeliveryTruck t => 200, | |
null => 0, | |
{ } => 0, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment