UMBC CS 201, Fall 02
 UMBC CMSC 201 Fall '02 CSEE | 201 | 201 F'02 | lectures | news | help

 CMSC 201 Programming Project One World Traveler Out: Tuesday 9/24/02 Original Due Date: Midnight, Tuesday 10/1/02

## The Objective

The objective of this assignment is to get you familiar with good design practices, writing in C in a Unix environment, and using functions.

## The Background

Ms. Block, Ms. Bogar and three other faculty members from the CSEE department recently attended the SIGIR conference that was held in Tampere, Finland. 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. (See the "Tours" link on the SIGIR 2002 page). 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.

Your "World Traveler" project will allow the user to perform conversions from these four currencies into US dollars, calculate the time of day (Eastern 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 :

• TIME:
• London time is 5 hours ahead of Eastern Time
• Stockholm time is 6 hours ahead of Eastern Time
• Tampere and Helsinki time is 7 hours ahead of Eastern Time
• St. Petersburg time is 8 hours ahead of Eastern Time

• CURRENCY:
• There are 1.5369 dollars per British pound
• There are 0.1062 dollars per Swedish krona
• There are 0.9692 dollars per Euro
• There are 0.0316 dollars per Russian Rouble

• You may use the function CelsiusToFahrenheit() provided on the lecture notes for temperature conversions.

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 may choose to use more functions if you wish, but these are sufficient.

• void PrintGreeting (void); -- displays a suitable greeting to the user
• int GetMenuResponse (int min, int max); -- gets an integer from the user between min and max, inclusive and returns that valid integer as the menu choice.
• void DisplayLocations (void); -- displays the location menu choices
• void ConvertTime (void); -- a high level function that handles all of the user input, processing, and output dealing with converting time.
• void ConvertCurrency (void); -- a high level function that handles all of the user input, processing, and output dealing with converting currency.
• void ConvertTemp (void); -- a high level function that handles all of the user input, processing, and output dealing with converting temperature.
• int ForeignTimeToEastern (int hour, int adjustment); -- changes the hour (24-hour clock) passed in by the amount of the adjustment yeilding Eastern Time in 24-hour form
• void PrintInUSForm (int hour, int minutes); -- receives a time in 24-hour form and prints out that time in 12-hour form with AM or PM.
• float ForeignToDollars (float units, float conv); -- accepts the number of units of a foreign currency and a conversion factor and returns the equivalent number of US dollars.
• int CelciusToFahrenheit (int celsius); -- returns the fahrenheit equivalent of the celsius temperature passed in.
• int GetValidInt(int min, int max); -- gets an integer from the user between min and max, inclusive and returns that valid integer.

You MUST use separate compilation for this project.
gcc -c -Wall -ansi proj1.c
gcc -c -Wall -ansi travel.c
gcc -Wall -ansi proj1.o travel.o

## Sample Run

Although your output need not be identical to the above, all information (including the greeting) must be present.

## 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 F'02 | lectures | news | help

Monday, 23-Sep-2002 22:06:39 EDT