Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("MSU Undergraduate Tuition Calculator.")
- print("")
- # Chunk below establishes strings, defines strings, and defines ints
- YES = "yes"
- NO = "no"
- FRESHMAN = "freshman"
- SOPHOMORE = "sophomore"
- JUNIOR = "junior"
- SENIOR = "senior"
- main_loop = 0 # Broken at end
- grade_loop = 0 # Needs to be reset
- credit_loop = 0 # Needs to be reset
- college = "" # Needs to be reset
- COE_admit = "" # Needs to be reset
- grade = "" # Needs to be reset
- ENGINEERING = "engineering"
- HEALTH = "health"
- SCIENCES = "sciences"
- BUSINESS = "business"
- CMSE = "cmse"
- NONE = "none"
- is_JMC = "" # NEEDS TO BE RESET
- ASMU_TAX = 21
- RADIO_TAX = 3
- is_international = "" #RESET
- major = "" # NEEDS TO BE RESET
- is_resident = ""
- while main_loop == 0:
- # Chunk below asks if user is resident and international if necessary
- resident_ask = input("Resident (yes/no): ")
- if resident_ask.lower() == YES:
- is_resident = YES
- elif resident_ask.lower() == NO or resident_ask.lower() != YES:
- is_resident = NO
- inter_ask = input("International (yes/no): ")
- if inter_ask.lower() == YES:
- is_international = YES
- elif inter_ask.lower() == NO or inter_ask.lower() != NO:
- is_international = NO
- # Loop below asks for grade until valid one is entered
- while grade_loop != 1:
- grade_ask = input("Level—freshman, sophomore, junior, senior: ")
- if grade_ask.lower() == FRESHMAN:
- grade = grade + FRESHMAN
- print(grade)
- grade_loop = 1
- elif grade_ask.lower() == SOPHOMORE:
- grade = grade + SOPHOMORE
- grade_loop = 1
- elif grade_ask.lower() == JUNIOR:
- grade = grade + JUNIOR
- grade_loop = 1
- elif grade_ask.lower() == SENIOR:
- grade = grade + SENIOR
- grade_loop = 1
- else:
- print("Invalid input. Try again.")
- # Chunk below asks user about college they are in and assigns major
- if grade == SENIOR or grade == JUNIOR:
- college_ask = input("Enter college as business, engineering, health, sciences, or none:\n")
- college = college + college_ask
- if college.lower() == ENGINEERING:
- major = major + ENGINEERING
- elif college.lower() == BUSINESS:
- major = major + BUSINESS
- elif college.lower() == HEALTH:
- major = major + HEALTH
- elif college.lower() == SCIENCES:
- major = major + SCIENCES
- print("Is your major CMSE (\"Computational Mathematics and Engineering\")")
- is_cmse = input("(yes/no): ")
- if is_cmse.lower() == YES:
- major = major + CMSE
- elif major != ENGINEERING and major != BUSINESS and major != HEALTH and major != SCIENCES and major != CMSE:
- major = major + NONE
- if major == NONE or major == CMSE:
- JMC_ask = input("Are you in the James Madison College (yes/no): ")
- if JMC_ask.lower() == YES:
- is_JMC = YES
- elif JMC_ask.lower() == NO or JMC_ask.lower() != YES:
- is_JMC = NO
- elif grade == FRESHMAN or SOPHOMORE:
- is_COE_admit = input("Are you admitted to the College of Engineering (yes/no) ")
- if is_COE_admit.lower() == YES:
- COE_admit = COE_admit + YES
- elif is_COE_admit.lower() == NO or is_COE_admit.lower() != YES:
- COE_admit = COE_admit + NO
- if COE_admit == NO:
- JMC_ask = input("Are you in the James Madison College (yes/no): ")
- if JMC_ask.lower() == YES:
- is_JMC = YES
- elif JMC_ask.lower() == NO or JMC_ask.lower() != YES:
- is_JMC = NO
- # Chunk below calculates credits
- while credit_loop != 1:
- credit_ask = input("Credits: ")
- if credit_ask.isdigit() == True:
- credits = int(credit_ask)
- if credits > 0:
- credits = credits
- credit_loop = 1
- elif credits <= 0:
- print("Invalid Input. Try Again.")
- else:
- print("Invalid Input. Try Again.")
- # Chunk below calculates Tuition
- cost = 0
- # Student Voted Costs
- cost = ASMU_TAX + RADIO_TAX
- if is_JMC == YES:
- cost = cost + 7.5
- else:
- cost = cost
- if credits >= 6:
- cost = cost + 5
- # Special Fees for international
- if is_international == YES and credits <= 4:
- cost = cost + 375
- elif is_international == YES and credits >4:
- cost = cost + 750
- # Special Fees for CMSE
- if major == CMSE and credits <= 4:
- cost = cost + 402
- elif major == CMSE and credits > 4:
- cost = cost + 670
- # Special fees for sciences
- if major == SCIENCES and credits <= 4:
- cost = cost + 50
- elif major == SCIENCES and credits > 4:
- cost = cost + 100
- # Special fees for health
- if major == HEALTH and credits <= 4:
- cost = cost + 50
- elif major == HEALTH and credits > 4:
- cost = cost + 100
- # Special fees for business
- if major == BUSINESS and credits <= 4:
- cost = cost + 113
- elif major == BUSINESS and credits > 4:
- cost = cost + 226
- # Special fees for college of engineering
- if COE_admit == YES and credits <= 4:
- cost = cost + 402
- elif COE_admit == YES and credits > 4:
- cost = cost + 670
- # Core costs [FRESHMAN]
- elif grade == FRESHMAN and credits < 12 and is_resident == YES:
- cost = cost + (credits * 482)
- print("a")
- elif grade == FRESHMAN and credits > 11 and credits < 19 and is_resident == YES:
- cost = cost + 7230
- print("b")
- elif grade == FRESHMAN and credits > 18 and is_resident == YES:
- cost = cost + 7230 + ((credits-18)*482)
- print("c")
- elif grade == FRESHMAN and credits < 12 and is_resident == NO:
- cost = cost + (credits * 1325.5)
- print("d")
- elif grade == FRESHMAN and credits > 11 and credits < 19 and is_resident == NO:
- cost = cost + 19883
- print("e")
- elif grade == FRESHMAN and credits > 18 and is_resident == NO:
- cost = cost + 19883 + ((credits-18)*1325.5)
- print("f")
- # Core costs [SOPHOMORE]
- elif grade == SOPHOMORE and credits < 12 and is_resident == YES:
- cost = cost + (credits * 494)
- elif grade == SOPHOMORE and credits > 11 and credits < 19 and is_resident == YES:
- cost = cost + 7410
- elif grade == SOPHOMORE and credits > 18 and is_resident == YES:
- cost = cost + 7410 + ((credits - 18) * 494)
- ("this")
- elif grade == SOPHOMORE and credits < 12 and is_resident == NO:
- cost = cost + (credits * 1325.5)
- elif grade == SOPHOMORE and credits > 11 and credits < 19 and is_resident == NO:
- cost = cost + 19883
- elif grade == SOPHOMORE and credits > 18 and is_resident == NO:
- cost = cost + 19883 + ((credits - 18) * 1325.5)
- # Core costs [JUNIOR and SENIOR]
- if grade == JUNIOR and credits < 12 and is_resident == YES and major != BUSINESS and major != ENGINEERING and major != BUSINESS:
- cost = cost + (credits * 555)
- elif grade == JUNIOR and credits > 11 and credits < 19 and is_resident == YES and major != BUSINESS and major != ENGINEERING:
- cost = cost + 8325
- elif grade == JUNIOR and credits > 19 and is_resident == YES and major != BUSINESS and major != ENGINEERING:
- cost = cost + 8325 + ((credits-18)*555)
- print(3)
- elif grade == JUNIOR or grade == SENIOR and credits < 12 and is_resident == NO and major != BUSINESS and major != ENGINEERING:
- cost = cost + (credits * 1366.75)
- print(4)
- elif grade == JUNIOR or grade == SENIOR and credits > 11 and credits < 19 and is_resident == NO and major != BUSINESS and major != ENGINEERING:
- cost = cost + 20501
- print(5)
- elif grade == JUNIOR or grade == SENIOR and credits > 19 and is_resident == NO and major != BUSINESS and major != ENGINEERING:
- cost = cost + 20501 + ((credits-18)*1366.75)
- print(6)
- elif grade == JUNIOR or grade == SENIOR and credits < 12 and is_resident == YES and major == BUSINESS or major == ENGINEERING:
- cost = cost + (credits * 555)
- print(7)
- elif grade == JUNIOR and credits > 11 and credits < 19 and is_resident == YES and major == BUSINESS:
- cost = cost + 8325
- print(8)
- elif grade == JUNIOR or grade == SENIOR and credits > 19 and is_resident == YES and major == BUSINESS or major == ENGINEERING:
- cost = cost + 8325 + ((credits - 18) * 555)
- print(9)
- elif grade == JUNIOR or grade == SENIOR and credits < 12 and is_resident == NO and major == BUSINESS or major == ENGINEERING:
- cost = cost + (credits * 1366.75)
- print(10)
- elif grade == JUNIOR or grade == SENIOR and credits > 11 and credits < 19 and is_resident == NO and major == BUSINESS or major == ENGINEERING:
- cost = cost + 20501
- print(11)
- elif grade == JUNIOR or grade == SENIOR and credits > 19 and is_resident == NO and major == BUSINESS or major == ENGINEERING:
- cost = cost + 20501 + ((credits - 18) * 1366.75)
- print(12)
- #Chunk below prints out tuition cost
- tuiton = '${:,.2f}'.format(cost)
- print("Tuition is ", tuiton)
- go_again = input("Do you want to do another calculation (yes/no): ")
- if go_again.lower() == YES:
- grade_loop = 0
- grade = ""
- credit_loop = 0
- is_JMC = ""
- major = ""
- COE_admit = ""
- is_international = ""
- college = ""
- cost = 0
- is_resident = ""
- elif go_again.lower() == NO:
- main_loop = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement