HNRS 299, Spring 2017
Assignments
You will write a program which administers a questionaire, then prints back a few sentences using the information it got from you. The program will be written in the Python language, and it will use variables to keep the information it collects.
Name this program journey.py
Session 1:
Hi there! What is your name? Frodo Baggins Where are you going? Mount Doom How far have you traveled (in miles)? 10 Let me see if I have this straight: Frodo Baggins has traveled 52800 feet on the way to Mount Doom. Thanks for running the program.
Session 2:
Hi there! What is your name? Dorothy Where are you going? the Emerald City How far have you traveled (in miles)? 2 Let me see if I have this straight: Dorothy has traveled 10560 feet on the way to the Emerald City. Thanks for running the program.
In the above example, the underlined items are user input. The idea is that the person running the program (which might not be you) answers the three questions, and then the computer fits the answers into its sentence. Note that for this example to work, the user has to answer in a particular form. If the first user had answered 'to Mount Doom' in response to the second question, the program would print out 'Frodo Baggins has traveled 52800 feet on the way to to Mount Doom.' More advanced programs can check for this kind of thing and correct for it, but you don't have to worry about it for this assignment. Note also that the computer converts the distance from miles to feet. Recall that 1 mile is 5280 feet. Your program should print out the number of feet that corresponds to the number of miles that the user inputs.
Name this program tipComputer.py.
A sample session might look like this:
As with the previous program, the user input is underlined. You should not worry about the number of decimal places printed for this particular problem, but the tips should be the correct amount for whatever the user inputs.Please enter the amount of the bill: 15.34 A 15% tip would be $ 2.301 A 20% tip would be $ 3.068
What you will turn in: