CMSC 201

# Homework 2--Due 2/12

This homework must be submitted by 8pm on the due date to get any credit.

In this homework, we will be doing a series of exercises designed to make you practice using variables, expressions, and if statements. Each one of these should be in a separate python file. For this assignment, you may assume that all the input you get will be of the correct type.

For this assignment, you'll need to follow the class coding standards, a set of rules designed to make your code clear and readable. The class coding standards are here

1. part1.py Read in three floats from the user (you may assume the user will actually enter numbers). Print out the average of these three numbers.
2. part2.py For this part, you will create a grade calculator. Your program should prompt the user for the following inputs, exactly in this order:
1. Homework weight
3. Exam Weight
5. Discussion Weight
Weights will always be between 0 and 1 (you don't need to check if they sum to one), while the grade will be between 0 and 100. Once you have computed the student's final grade, print out the letter grade to which that number corresponds (anything above a 90 is an A, between 80 and 89 is a B, 70 to 79 is a C, 60 to 69 is a D, and anything less than a 60 is an F) A weighted total is computed by multiplying each grade by the corresponding weight and summing them.
3. part3.py You're going to create some medical diagnoses software. You are going to ask the user if they have a fever, a rash, if they have a stuffy nose, and if their ear hurts, and give one of the following responses:
1. Don't have a fever and don't have a stuffy nose: Hypochondriac
2. Don't have a fever and have a stuffy nose: Head Cold
3. Have a fever, don't have a rash, and ear hurts: Ear Infection
4. Have a fever, don't have a rash, and ear doesn't hurt: Flu
5. Have a fever and have a rash: Measles
Sample output:
```Do you have a fever? (y/n): y
Do you have a rash? (y/n): n
Does your ear hurt? (y/n): y
Diagnosis: You have an ear infection.
```

Note that the user should only ever have to enter lower case y or lower case n. Deviation from this will result in loss of points. The user will only ever enter 'y' or 'n', and you should ASK THE MINIMUM NUMBER OF QUESTIONS REQUIRED.

4. part4.py You will ask the user for the state of two switches, and the user will answer with y or n. If the user answers y for both switches or n for both switches, you should print "The generator is off." If the user has entered y followed by n, or n followed by y, you should print "The generator is on." Please do this only using a single if-else statement (the if statement can have a combination of ands and ors)
5. part5.py Ask the user to enter a day of the month. We will assume the month starts on Monday and has 31 days. If the day of the month the user entered is not a valid day of the month (less than 1 or greater than 31), print "Invalid day". Otherwise print the day of the week that day falls on. For instance, the second would be a Tuesday, the 10th would be a Wednesday, etc.

# Submitting

When you've finished your homework, use the submit command to submit the file. You must be logged into your account and you must be in the same directory as the file you're trying to submit. At the Linux prompt, type

submit cs201 HW2 part1.py part2.py part3.py part4.py part5.py

After entering the submit command shown above, you should get a confirmation that submit worked correctly:

Submitting part1.py...OK

Submitting part2.py...OK

Submitting part3.py...OK

Submitting part4.py...OK

Submitting part5.py...OK

If not, check your spelling and that you have included each of the required parts and try again.

You can check your submission by entering:

submitls cs201 HW2

You should see the name of the file that you just submitted, in this case parts 1 through 4.

 Adapted from UMBC CSHC's webpage design