40 lines
1002 B
Python
40 lines
1002 B
Python
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)
|
|
|
|
|
|
def miniPriceBranch():
|
|
choseMiniPrice = boolInput(
|
|
'Minipris 199,- kan ikke refunderes/endres\nØnskes dette (J/N)? ')
|
|
if choseMiniPrice:
|
|
print('Takk for pengene, god reise!')
|
|
else:
|
|
normalBranch()
|
|
|
|
|
|
def evalDiscountPercent():
|
|
age = inputTypeCheck('Skriv inn din alder: ', int)
|
|
if age < 16:
|
|
return 50
|
|
elif age >= 60:
|
|
return 25
|
|
|
|
hasSpecialSocialStatus = boolInput('Er du student eller militær (J/N)?')
|
|
return 25 if hasSpecialSocialStatus else 0
|
|
|
|
|
|
def normalBranch():
|
|
discountPercent = evalDiscountPercent()
|
|
print(f'Prisen på biletten blir: {440 - 440 * discountPercent/100}')
|
|
|
|
|
|
if __name__ == "__main__":
|
|
daysToTrip = inputTypeCheck('Dager til du skal reise? ', int)
|
|
|
|
if daysToTrip >= 14:
|
|
miniPriceBranch()
|
|
else:
|
|
normalBranch() |