Assignment Overview
This assignment focuses on the design, implementation and testing of a Python program to compute tuition charges at MSU (see below).
Assignment Deliverable
The deliverable for this assignment is the following file:
proj03.py the source code for your Python program
Be sure to use the specified file name and to submit it for grading via the Mimir system before the project deadline.
Assignment Background
MSU has an on-line tuition calculator:
http://ctlr.msu.edu/COStudentAccounts/TuitionCalculatorFall.aspx
That calculator is based on information such as that posted at:
http://ctlr.msu.edu/COStudentAccounts/Tuition_FeesResident_Undergrad_2019-20.aspx
Assignment Specifications
- You will develop a Python program which calculates the tuition for an undergraduate MSU student during Fall Semester 2019, based on parameters supplied by the user (such as the students residency status and class level).
- Your program will permit mixed-case input strings. For example, the strings yes, Yes, YES and yES will all be processed by your program as equivalent user inputs.
- The calculated tuition will be displayed with a dollar sign ($) and commas for the thousands. That is, a value of 12345.67 will be displayed as $12,345.67 by your program. Also, even dollar amounts will have zeros for cents (for example, a value of 12 will be displayed as
$12.00).
- The following tables give the necessary values.
College and year | Resident | Non-Resident & International | ||||
Per Credit (111) | Flat Rate (1218) | Flat + Credit (>18) | Per Credit (1-11) | Flat Rate (1218) | Flat + Credit (>18) | |
Core Units | ||||||
Freshman | $482 | $7,230 | Flat + credit | $1,325.50 | $19,883 | Flat + credit |
Sophomore | $494 | $7,410 | Flat + credit | $1,325.50 | $19,883 | Flat + credit |
Junior | $555 | $8,325 | Flat + credit | $1,366.75 | $20,501 | Flat + credit |
Senior | $555 | $8,325 | Flat + credit | $1,366.75 | $20,501 | Flat + credit |
Eli Broad College of Business & College of Engineering | ||||||
Freshman | $482 | $7,230 | Flat + credit | $1,325.50 | $19,883 | Flat + credit |
Sophomore | $494 | $7,410 | Flat + credit | $1,325.50 | $19,883 | Flat + credit |
Junior | $573 | $8,595 | Flat + credit | $1,385.75 | $20,786 | Flat + credit |
Senior | $573 | $8,595 | Flat + credit | $1,385.75 | $20,786 | Flat + credit |
Special Fees (per semester) | ||
Part-Time (4 credits or fewer) | Full-Time | |
Business juniors and seniors | $113 | $226 |
Engineering admitted | $402 | $670 |
Health juniors and seniors | $50 | $100 |
Sciences juniors and seniors | $50 | $100 |
CMSE juniors and seniors | $402 | $670 |
International | $375 | $750 |
Student-Voted Taxes (per semester) | ||
ASMSU Tax all undergraduate students | $21 | |
FM Radio Tax all students | $3 | |
State News Tax all students with 6 or more credits | $5 | |
James Madison College Student Senate Tax all students in James Madison College | $7.50 |
- flat + credit: Students taking more than 18 credits calculate their tuition by starting with the flat fee and adding on the specified per-credit for each credit greater than 18. For example, a student taking 20 credits pays the flat rate plus 2*(per-credit). The per-credit value is the value in the per-credit (1-11) column.
- Input Specification and Ordering: To facilitate grading the input must be in the following order:
- Resident (yes/no):
- If not resident, International (yes/no):
- Enter Level as freshman, sophomore, junior, senior:
- If level is junior or senior, ask for College.
Collegebusiness, engineering, health, sciences, none:
- If level is junior or senior ask if major is CMSE (Computational Mathematics and Engineering) (yes/no)
- If level is freshman or sophomore, ask if admitted to College of Engineering (yes/no):
- If college not business, engineering, health or sciences, ask if James Madison
College (yes/no)
- Credits
- Ask if the user wants to do another calculation.
Assignment Notes
- To clarify the project specifications, sample output is provided at the end of this document.
- Your program must accept user inputs in the order specified.
- Python 3 provides formatting for the dollar output. A comma (,) causes commas to be properly placed in numbers. Note that the ordering matters so that comma is placed immediately after the colon and before other formatting marks, e.g. {:,.2f} Experiment in the shell.
- The string method lower() can be used to convert all letters in a string to lower case. This is particularly useful for input, that is you can handle yEs, yeS, YEs, etc by converting the input to lower case and checking against yes.
- The Python None is a useful default initialization for variables that may not be assigned a value. For example, not everyone is asked for their college so initializing college to None can be handy because None evaluates as False in a Boolean expression.
college = None if college:
print(this will not print if college has the value None)
- Notes on handling input errors:
- For yes/no questions, assign all answers that are not yes to be no .
- For the question about college that has an option of none, assign any answer to be none (or None, if you wish) for any response that is not one of the specified colleges.
- For level, if the answer is not one of the specified responses (freshman, etc.), you must print an error message Invalid input. Try again. and re-prompt until you get a specified response.
- For credits, input must be an integer greater than zero. Print an error message Invalid input. Try again. and re-prompt until you get an integer greater than zero. Hint:
the string isdigit() method useful here.
- Common error to avoid. You might like to use a Boolean expression such as this:
level == freshman or sophomore or junior or senior
Unfortunately, that expression always evaluates to True because any non-empty string is
True so it is effectively: level == freshman or True or True or True
Instead use the following
(level == freshman) or (level == sophomore) \ or (level == junior) or (level == senior)
- You are responsible for following the coding standard items 1-6
- You are not allowed to use advanced data structures such as list, dictionaries, classes, etc. However, you are allowed to read ahead and use try-except and functions.
- Hard-coded answers will receive a zero score for the project. That is, if you design your code to handle the specific test cases rather than the general problem, you will not get credit.
Sample Output
TEST 1
2019 MSU Undergraduate Tuition Calculator.
Resident (yes/no): yes
Enter Level as freshman, sophomore, junior, senior: freshman
Are you admitted to the College of Engineering (yes/no): no
Are you in the James Madison College (yes/no): no
Credits: 12
Tuition is $7,259.00.
Do you want to do another calculation (yes/no): no
TEST 2
2019 MSU Undergraduate Tuition Calculator.
Resident (yes/no): yes
Enter Level as freshman, sophomore, junior, senior: Junior Enter college as business, engineering, health, sciences, or none: business
Is your major CMSE (Computational Mathematics and Engineering)
(yes/no): No
Credits: 17
Tuition is $8,850.00.
Do you want to do another calculation (yes/no): no
TEST 3
2019 MSU Undergraduate Tuition Calculator.
Resident (yes/no): yEs
Enter Level as freshman, sophomore, junior, senior: Senior Enter college as business, engineering, health, sciences, or none: engineering
Is your major CMSE (Computational Mathematics and Engineering)
(yes/no): no
Credits: 5
Tuition is $3,559.00.
Do you want to do another calculation (yes/no): Yes
Resident (yes/no): nO
International (yes/no): yes
Enter Level as freshman, sophomore, junior, senior: sophomore
Are you admitted to the College of Engineering (yes/no): yes
Credits: 20
Tuition is $23,983.00.
Do you want to do another calculation (yes/no): no
TEST 4
2019 MSU Undergraduate Tuition Calculator.
Resident (yes/no): yes
Enter Level as freshman, sophomore, junior, senior: xxx
Invalid input. Try again.
Enter Level as freshman, sophomore, junior, senior: yyy
Invalid input. Try again.
Enter Level as freshman, sophomore, junior, senior: junior Enter college as business, engineering, health, sciences, or none: abcd
Is your major CMSE (Computational Mathematics and Engineering)
(yes/no): yes
Are you in the James Madison College (yes/no): no
Credits: 0
Invalid input. Try again.
Credits: ab
Invalid input. Try again.
Credits: 3.5
Invalid input. Try again.
Credits: 11
Tuition is $6,804.00.
Do you want to do another calculation (yes/no): no
Grading Rubric
Computer Project #3
Scoring Summary
General Requirements:
(4 pts) Coding Standard 1-6
(descriptive comments, mnemonic identifiers, format, etc)
Implementations:
(4 pts) Test 1
(4 pts) Test 2
(4 pts) Test 3
(4 pts) Test 4
Reviews
There are no reviews yet.