Cover page images (keyboard)

HW8 - Top-down Design


due on Sunday, 4/17/11 before 11:59 PM

Sue Evans

Hit the space bar for next slide

World Traveler

Background

Mrs. Evans, Ms. Block and three other faculty members from the CSEE department attended the SIGIR conference that was held in Tampere, Finland a few years ago. On the way, we stopped in London for one night and in Stockholm for the weekend. The conference was from Monday - Thursday in Tampere. After the conference, we took a bus tour to St. Petersburg, Russia. After the Russian tour, we spent the night in Helsinki, then another night in London before returning home. Our trip caused us to visit 5 cities in 4 different countries. Each of these countries was in a different time zone and each used a different currency. All of Europe uses the Celsius scale for temperatures. It just seemed as if we were always doing conversions.

The Task

Your "World Traveler" program will allow the user to perform conversions from these four currencies into US dollars, calculate the time of day (Eastern Standard Time) from the time in each of the 5 cities visited, and also convert celsius temperatures into fahrenheit temperatures. Your program must be menu driven and will involve two different menus, the main menu that uses integer choices and a menu of locations that uses character choices. You will find the following information useful :

You MUST write this homework using the design explained in lecture on 4/12 and 4/13 without modification. See the design diagram for clarification.

You MUST use constants for each of the conversion factors shown above, both time and currency. You must also use constants for the main menu choices and the values used must match those shown in the sample output (1 is for time, 2 for currency, 3 for temperature and 4 quits.) Include constants for any other items where they would be appropriate, so that you have no "magic numbers" appearing in your code.

The letter choices for the locations menu must also match the cities as shown in the sample output, (L,S,T,H,P & M) and should allow both upper and lower-case versions of those letters and should continually re-prompt when invalid letters are entered.

Your program MUST include the following functions. Do NOT change the function headers shown below:

The Design Diagram

Sample Output

linuxserver1.cs.umbc.edu[101] python hw8.py

Your greeting goes here

What would you like to convert ?

        1 - Time
        2 - Currency
        3 - Temperature
        4 - QUIT

Your choice (1 - 4): 1

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : L

What time is it ?

Enter the hour (0 - 23): 22
Enter the minute (0 - 59): 15

22:15 in London is  5:15 PM EST

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : s

What time is it ?

Enter the hour (0 - 23): 10
Enter the minute (0 - 59): 45

10:45 in Stockholm is  4:45 AM EST

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : p

What time is it ?

Enter the hour (0 - 23): 24
Enter the hour (0 - 23): 25
Enter the hour (0 - 23): 18
Enter the minute (0 - 59): 60
Enter the minute (0 - 59): 30

18:30 in St. Petersburg is 10:30 AM EST

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : m

What would you like to convert ?

        1 - Time
        2 - Currency
        3 - Temperature
        4 - QUIT

Your choice (1 - 4): 2

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : l
How many pounds ?  20

20.00 pounds is $ 30.75

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : s
How many kronor ?  500

500.00 kronor is $ 69.54

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : t
How many euros ?  45

45.00 euros is $ 60.73

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : p
How many rubles ?  1000

1000.00 rubles is $ 34.33

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : q
q isn't a valid choice.  Try again.

Choose a location or M to return to Main Menu

        L  - London
        S  - Stockholm
        T  - Tampere
        H  - Helsinki
        P  - St. Petersburg
        M  - Return to Main Menu

Enter location or M to return to Main Menu : m

What would you like to convert ?

        1 - Time
        2 - Currency
        3 - Temperature
        4 - QUIT

Your choice (1 - 4): 5
Your choice (1 - 4): 0
Your choice (1 - 4): 3
What is the Celsius temperature ? 27
27 degrees C is 80.6 degrees F


What would you like to convert ?

        1 - Time
        2 - Currency
        3 - Temperature
        4 - QUIT

Your choice (1 - 4): 4
linuxserver1.cs.umbc.edu[102] 

Input Guarantees

Submitting Your Work

After you've finished your assignment, use the submit command to turn it in.

Don't forget to watch for the confirmation that submit worked correctly. Specifically, the confirmation will say:

Submitting hw8.py...OK

If not, try again.

You can check your submission by entering
submitls cs201 HW8
You should see the name of the file that you just submitted, in this case, hw8.py.