### Homework 1 - due Wednesday, 9/16 before class

#### 0) Survey

Complete survey linked to from the schedule on the course website. (Was due Thursday, 9/10.)

#### 1) Office hours

Come to see me in my office during office hours.

My office is Steinmetz Hall 233.

Office hours are: Tuesday 1-3pm and Friday 1-3pm or you can make an appointment for another time.

The purpose of this exercise is that you all know where to find me and
that I get some feedback on whether the times of my office hours work for people.

#### 2) Tip, Tax, Total (Gaddis, Ch. 2, Programming Exercises No. 8)

Write a program that calculates the total amount of a meal purchased at a restaurant. The program should ask the user to enter the charge for the food, and then calculate the amount of a 15 percent tip and a 7 percent sales tax. Display each of these amounts and the total.

#### 3) Distance Traveled (Gaddis, Ch. 2, Programming Exercise No. 5)

Assuming there are no accidents or delays, the distance that a car travels down the interstate can be calculated with the following formula:

distance = speed * time

A car is traveling at 60 miles per hour. Write a program that displays the following:

- The distance the car will travel in 5 hours.
- The distance the car will travel in 8 hours.
- The distance the car will travel in 12 hours.

#### What to hand in and how I am going to evaluate it

Please submit all homework solutions on Blackboard. (Since many of you are Freshmen and maybe haven't used Blackboard before, we will talk about that in class on Monday.)

For the programming exercises (Questions 2 and 3), please submit the following things:

- a description (in English) of the algorithm that you are planning on implementing. You should think about the problem that you need to solve, the steps necessary to solve it, and then write this algorithm. And all of this should happen before you start to program.
- the Python implementation of your algorithm.
- Test cases. If your program takes any input, say which inputs can be used to test the program as thoroughly as possible. That is, all different categories of possible inputs should be covered.

Your Python code may not produce any error messages when I run it. I will not grade code that produces error messages. So please make sure that there are no errors before you submit it. If there is an error message and you just can't figure out what is causing this error, come to see me.

If your code does not produce any error messages, but does not behave in the way that it should and you cannot figure out how to fix it and there is no time to come to see me, hand in a description of what is going wrong and under which circumstances it is going wrong.

I will evaluate your solutions along the following dimensions:

- Is the code easily readable?
- Is the code thoroughly tested?
- Is the code correct?
- Is the code efficient?

Here is a more detailed description of the criteria that I am going to use to judge your solutions.

Remember: you can work in groups of up to three people on this homework assignment.

Everybody who contributed to the solution should be named. Furthermore, all other resources that you used should be named, such as the book, the Python documentation online etc.