-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcollegeAttendanceCalc.py
100 lines (89 loc) · 4.03 KB
/
collegeAttendanceCalc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Number input error handling function #
def number_input(message):
while True:
try:
user_input = int(input(message))
except ValueError:
print('Please enter a number: ')
continue
else:
return user_input
break
if __name__ == '__main__':
# Prompts users to enter the amount of credits they
# are taking and multiplies that number by 94 #
creds = number_input('How many credits are you taking? ')
print()
cred_cost = creds * 94
# Prompts the user if they are in or out of state students
# and calculates the cost based on their decisions #
location = ''
while location != 'in-state' and location != 'out-of-state':
location = input('Are you an in-state or out-of-state student? ')
print()
if location != 'in-state' and location != 'out-of-state':
print('Please select one of the provided options: ')
if location == 'in-state':
tuition = 3784
if location == 'out-of-state':
tuition = 6604
# Prompts the user if their living situation will be on
# or off campus and calculates value based off decision #
living_sit = ''
while living_sit != 'on-campus' and living_sit != 'off-campus':
living_sit = input('Are you living on-campus or off-campus? ')
print()
if living_sit != 'on-campus' and living_sit != 'off-campus':
print('Please select one of the provided options: ')
# If on-campus living is selected the user is prompted to
# specify what hall or apartment they live in to calculate cost #
if living_sit == 'on-campus':
while living_sit != 'Rancourt Hall' and living_sit != 'Fortin Hall' and \
living_sit != 'Apartment':
try:
campus_spot = input('Do you stay at Rancourt Hall, Fortin Hall, or' \
' an Apartment? ')
print()
if campus_spot != 'Rancourt Hall' and campus_spot != 'Fortin Hall' \
and campus_spot != 'Apartment':
print('Please select one of the provided options: ')
else:
living_sit = campus_spot
if campus_spot == 'Rancourt Hall':
campus_spot = 9340
break
elif campus_spot == 'Fortin Hall':
campus_spot = 8600
break
elif campus_spot == 'Apartment':
campus_spot = number_input('What is the monthly rate of your rent? ')
campus_spot = campus_spot * 12
print('your rent will add up to',campus_spot,'for the whole year')
print()
break
except:
break
# If off-campus living situation is selected the user is prompted to
# enter their monthly rent so the cost of the year can be calculated #
if living_sit != 'on-campus' and living_sit == 'off-campus':
rent = number_input('What is the monthly rate of your rent? ')
rent = rent * 12
print('your rent will add up to',rent,'for the whole year')
print()
# Prompts users to enter the amount annually spent on nooks #
books = number_input('How much on average would you say you spend on books? ')
print()
misc = number_input('Are their any other miscellanious costs to take' \
' into consideration? ')
print()
# Calculates total cost for off-campus student #
if living_sit == 'off-campus':
total = cred_cost + tuition + rent + books + misc
print()
print('Your estimated annual cost is:',total)
quit()
# Calculates total cost for on-campus student #
if campus_spot == 'Rancourt Hall' or 'Fortin Hall' or 'Apartment':
total = cred_cost + tuition + campus_spot + books + misc
print()
print('Your estimated annual cost is:',total)