Created
August 20, 2020 19:26
-
-
Save mkock/8346dc3ca523523377770b42f72fa18b to your computer and use it in GitHub Desktop.
Bus Ride, code snippet 26
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
| // BusCompany represents the bus company responsible for the Bus service. BusCompany determines price policies. | |
| type BusCompany string | |
| // GetPricing returns a price calculator based on the pricing policy of the day. | |
| func (b BusCompany) GetPricing() PriceCalculator { | |
| wd := time.Now().Weekday() | |
| if wd == time.Saturday || wd == time.Sunday { | |
| return WeekendPricing | |
| } | |
| return WorkdayPricing | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment