2020-09-16 15:01:12 +02:00
|
|
|
try:
|
|
|
|
from common.inputChecking.boolInput import boolInput
|
|
|
|
from common.inputChecking.typeCheck import inputTypeCheck
|
|
|
|
except ModuleNotFoundError:
|
|
|
|
print('Sjekk README.md for hvilke flagg python trenger')
|
|
|
|
exit(1)
|
2020-09-07 14:44:46 +02:00
|
|
|
|
|
|
|
|
2020-09-07 14:53:57 +02:00
|
|
|
def miniPriceBranch():
|
2020-09-16 15:01:12 +02:00
|
|
|
choseMiniPrice = boolInput(
|
|
|
|
'Minipris 199,- kan ikke refunderes/endres\nØnskes dette (J/N)? ')
|
2020-09-07 14:53:57 +02:00
|
|
|
if choseMiniPrice:
|
|
|
|
print('Takk for pengene, god reise!')
|
|
|
|
else:
|
|
|
|
normalBranch()
|
|
|
|
|
2020-09-16 15:01:12 +02:00
|
|
|
|
2020-09-07 14:44:46 +02:00
|
|
|
def evalDiscountPercent():
|
2020-09-16 15:01:12 +02:00
|
|
|
age = inputTypeCheck('Skriv inn din alder: ', int)
|
2020-09-07 14:44:46 +02:00
|
|
|
if age < 16:
|
|
|
|
return 50
|
|
|
|
elif age >= 60:
|
|
|
|
return 25
|
2020-09-16 15:01:12 +02:00
|
|
|
|
2020-09-07 14:44:46 +02:00
|
|
|
hasSpecialSocialStatus = boolInput('Er du student eller militær (J/N)?')
|
|
|
|
return 25 if hasSpecialSocialStatus else 0
|
|
|
|
|
2020-09-16 15:01:12 +02:00
|
|
|
|
2020-09-07 14:53:57 +02:00
|
|
|
def normalBranch():
|
|
|
|
discountPercent = evalDiscountPercent()
|
|
|
|
print(f'Prisen på biletten blir: {440 - 440 * discountPercent/100}')
|
2020-09-07 14:44:46 +02:00
|
|
|
|
|
|
|
|
2020-09-16 15:01:12 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
daysToTrip = inputTypeCheck('Dager til du skal reise? ', int)
|
2020-09-07 14:44:46 +02:00
|
|
|
|
2020-09-16 15:01:12 +02:00
|
|
|
if daysToTrip >= 14:
|
|
|
|
miniPriceBranch()
|
|
|
|
else:
|
|
|
|
normalBranch()
|