Sale!

# Homework 3: Tuition fees

\$30.00

Category:

## Description

COMP 1800

Homework 3: Conditionals

(40 points)

1. (20 pts) Save your script file as: HW3Problem1.pySuppose that a university uses the following scheme to compute tuition fees.  This is loosely based on how the U of M actually does it!
• Tuition costs \$350 per credit hour for each hour up to and including 12.
• For each hour beyond 12, the cost is \$40 per credit hour.
• Engineering and science courses are charged an extra lab fee of \$25 per credit hour.

Examples:

Alvin is taking 9 hours, 3 of which are from engineering/science courses.  His tuition is calculated like this:

(\$350 per credit hour up to 12) * (9 credit hours)            =          \$3150
(\$25 per E/S credit hour) * (3 credit hours)                    =          \$75
TOTAL                                                                        =          \$3225

Brooke is taking 17 hours, 14 of which are from engineering/science courses.  Her tuition is calculated like this:

(\$350 per credit hour up to 12) * (12 credit hours)          =          \$4200
(\$40 per credit hour beyond 12) * (5 credit hours)          =          \$200
(\$25 per E/S credit hour) * (14 credit hours)                   =          \$350
TOTAL                                                                        =          \$4750

In script mode, write a Python program that asks the user to enter 1) his/her total number of credit hours, and 2) the number of those hours from engineering/science courses.  The program should then calculate and display the appropriate tuition charges, broken down by category like in the examples above.  Hint: Consider two separate cases: students who are taking 12 hours or below, and students who are taking over 12 hours.

The top of the next page has an example of what your program might look like when you run it (the underlined parts indicate what you type in as the program is running):

How many total hours are you taking? 17

How many of those hours are from engineering/science classes? 14

Summary of Charges:
——————-
(\$350 per credit hour up to 12) * (12 credit hours)   =     \$4200

(\$40 per credit hour beyond 12) * (5 credit hour(s))  =     \$200

(\$25 per eng./sci. credit hour) * (14 credit hour(s)) =     \$350

TOTAL                                                 =     \$4750

1. (20 pts) Save your script file as: HW3Problem2.py

You might be familiar with online quizzes that you take through Facebook or other websites.  Suppose that you want to develop a “What Type of Car Are You?” quiz.  Your quiz will consist of five different statements, and the person taking the quiz will indicate how much s/he agrees or disagrees with each statement.  Let’s say that there are 5 possible “degrees of agreement” (this is known as a Likert scale):

1. Strongly disagree
2. Disagree
3. Neither agree nor disagree
4. Agree
5. Strongly agree

Let’s also assume that the quiz consists of the following 5 statements:

1. I am a risk taker.
2. I like wearing fancy clothes.
3. I value appearance over practicality.
4. I don’t mind spending my money freely.
5. I consider myself a fun-loving person.

Write a Python program that simulates taking this quiz.  Your program should present each of the above statements one by one and collect the person’s response (1-5) for each statement.  Then, at the end of the program, display the total “score” for the survey (the sum of the responses) and an overall result based on the following scale:

 Sum of responses Overall result 21-25 You are an exotic convertible! 11-20 You are a sporty compact! 10 or below You are a family sedan!