UMBC CS 201, Spring 08
UMBC CMSC 201
Spring '08

CSEE | 201 | 201 S'08 | lectures | news | help

CMSC 201
Programming Project One

World Traveler






Out: Wednesday 2/20/08

Due Date: By 11:59:59 PM, Sunday 3/2/08

The Objectives

The objective of this assignment is to get you familiar with good design practices, writing in C in a Unix environment, writing functions and using separate compilation. It will also give you experience with menus, using loops and switch statements.

The Background

Ms. Block, Mrs. Evans 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" project 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 and a menu of locations.

You will find the following information useful :

You MUST write this project using the design explained in lecture on 2/20 and 2/21 without modification.

You MUST use constants (#define) for each of the conversion factors shown above, both time and currency. You must also use constants for your menu choices and for any other item where they would be appropriate.

Your program MUST include the following functions. Do NOT change the function prototypes given below.

You MUST use separate compilation for this project.
So you should have 3 files:

For this first project, we will be putting all of the function definitions, other than main(), in the travel.c file. As we progress through the semester, we'll discuss more appropriate placement of hiding-details and module function definitions.

Here is how you will be compiling these files :
gcc -c -Wall -ansi proj1.c
gcc -c -Wall -ansi travel.c
gcc proj1.o travel.o

Please notice that the travel.h file does not get compiled. It gets #included in both of the .c files, but not compiled. The header file is absolutely necessary, so don't forget to submit it along with your other files.

Sample Run

linux1[101] % gcc -c -Wall -ansi proj1.c
linux1[102] % gcc -c -Wall -ansi travel.c
linux1[103] % gcc proj1.o travel.o
linux1[104] % a.out

Your Greeting Goes Here


        1 - Convert Time

        2 - Convert Currency

        3 - Convert Temperature

        4 - Quit


Your Choice ?
Please enter an integer between 1 and 4 : 1


Where are you ?

        1 - London

        2 - Stockholm

        3 - Tampere

        4 - Helsinki

        5 - St. Petersburg


Your location ?
Please enter an integer between 1 and 5 : 1

What time is it ?
hour ?
Please enter an integer between 0 and 23 : 22
minutes ?
Please enter an integer between 0 and 59 : 15

22:15 London time is  5:15 PM Eastern

        1 - Convert Time

        2 - Convert Currency

        3 - Convert Temperature

        4 - Quit


Your Choice ?
Please enter an integer between 1 and 4 : 1


Where are you ?

        1 - London

        2 - Stockholm

        3 - Tampere

        4 - Helsinki

        5 - St. Petersburg


Your location ?
Please enter an integer between 1 and 5 : 2

What time is it ?
hour ?
Please enter an integer between 0 and 23 : 10
minutes ?
Please enter an integer between 0 and 59 : 45

10:45 Stockholm time is  4:45 AM Eastern

        1 - Convert Time

        2 - Convert Currency

        3 - Convert Temperature

        4 - Quit


Your Choice ?
Please enter an integer between 1 and 4 : 1


Where are you ?

        1 - London

        2 - Stockholm

        3 - Tampere

        4 - Helsinki

        5 - St. Petersburg


Your location ?
Please enter an integer between 1 and 5 : 5

What time is it ?
hour ?
Please enter an integer between 0 and 23 : 24
Please enter an integer between 0 and 23 : 25
Please enter an integer between 0 and 23 : 28
Please enter an integer between 0 and 23 : 18
minutes ?
Please enter an integer between 0 and 59 : 60
Please enter an integer between 0 and 59 : 30

18:30 St. Petersburg time is 10:30 AM Eastern

        1 - Convert Time

        2 - Convert Currency

        3 - Convert Temperature

        4 - Quit


Your Choice ?
Please enter an integer between 1 and 4 : 2
Where are you ?

        1 - London

        2 - Stockholm

        3 - Tampere

        4 - Helsinki

        5 - St. Petersburg


Your location ?
Please enter an integer between 1 and 5 : 1

How many pounds ? 20
20.00 pounds is $ 39.22

        1 - Convert Time

        2 - Convert Currency

        3 - Convert Temperature

        4 - Quit


Your Choice ?
Please enter an integer between 1 and 4 : 2
Where are you ?

        1 - London

        2 - Stockholm

        3 - Tampere

        4 - Helsinki

        5 - St. Petersburg


Your location ?
Please enter an integer between 1 and 5 : 4

How many euros ? 75
75.00 euros is $ 110.09

        1 - Convert Time

        2 - Convert Currency

        3 - Convert Temperature

        4 - Quit


Your Choice ?
Please enter an integer between 1 and 4 : 2
Where are you ?

        1 - London

        2 - Stockholm

        3 - Tampere

        4 - Helsinki

        5 - St. Petersburg


Your location ?
Please enter an integer between 1 and 5 : 5

How many rubles ? 1000
1000.00 rubles is $ 40.67

        1 - Convert Time

        2 - Convert Currency

        3 - Convert Temperature

        4 - Quit


Your Choice ?
Please enter an integer between 1 and 4 : 5
Please enter an integer between 1 and 4 : 0
Please enter an integer between 1 and 4 : -2
Please enter an integer between 1 and 4 : 3
Enter the celsius temperature : 27

27 celsius is 80 fahrenheit


        1 - Convert Time

        2 - Convert Currency

        3 - Convert Temperature

        4 - Quit


Your Choice ?
Please enter an integer between 1 and 4 : 4
linux1[105] %


Although your output need not look identical to the above, it must be neat and all information (including the greeting) must be present. The results of the conversions must be correct.

Submitting the Program

You must name your source file that contains main() proj1.c The file that contains the function definitions should be called travel.c and the header file should be called travel.h.

To submit your project, type the following at the Unix prompt:

submit cs201 Proj1 proj1.c travel.c travel.h

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show all files that you submitted in a format similar to the Unix 'ls' command.

submitls cs201 Proj1


CSEE | 201 | 201 S'08 | lectures | news | help

Wednesday, 27-Feb-2008 16:20:32 EST