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

CMSC 201
Programming Project One

Dates

Out: Wednesday 9/27/00
Due: Before Midnight, Sunday 10/8/00

The Objective

The objective of this assignment is to get you started writing programs in C in the UNIX environment. Its main emphasis is design, so we will be designing the project together in class. This project will also give you practice writing functions, loops, switch statements and using seperate compilation.

The Background

You are just beginning to learn to program in C and you want to challenge yourself by writing a large enough program to test your design skills and to give you practice with seperate compilation. You decide to write a program that you can release as public domain software (give away to others). It should be something that is a little bit useful and maybe even a little bit fun ... something to do with dates.

First let's think about the useful part. It would be useful to be able to find the Julian date of any date the user enters. The Julian date is what day of the year it is. e.g. 01/01 corresponds to the julian date 1, 01/25 corresponds to the julian date 25, and 02/01 corresponds to the julian date 32.

Now the fun part ... It would be fun (and maybe even useful) for the user to be able to enter the current date and someone's birthdate and let the program respond with their age. e.g. I was born 9/29/1949, so today 9/27/2000, I am 50 years old. Beginning on Friday, 9/29/2000, I will be 51, until this time next year ... but you know how ages work.

And now the totally useless, but fun part ... It would be fun for the program to tell what a person's astrological sign is, given the person's birthdate. Here is a chart of dates and signs:

Astrological Sign Beginning Date Ending date
AriesMar 21Apr 19
TaurusApr 20May 20
GeminiMay 21June 21
CancerJune 22July 22
LeoJuly 23Aug 22
VirgoAug 23Sept 22
LibraSept 23Oct 23
ScorpioOct 24Nov 21
SagittariusNov 22Dec 21
CapricornDec 22Jan 19
AquariusJan 20Feb 18
PiscesFeb 19Mar 20

The Task

Design (to be done in class) and code a project that after printing a greeting to the user, presents the user with a menu and allows him to choose to find a julian date, find someone's age or find someone's sign given their birthday. After displaying the results, the user should be presented with the menu again, so that s/he can continue to make choices.

Since you are distributing this software to others, you must use seperate compilation and provide the interface for the user. This is in the form of a well commented header (.h) file.

Sample Run

ecs225d-sgi-01[102] a.out This program allows you to have fun with dates You can find the Julian date from the month day and year, or you can find out someone's age or their astrological sign. 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 1 Please enter the number of the month : 3 Please enter the 4-digit year : 2000 Please enter the day : 1 The Julian date for 3/1/2000 is 61 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 1 Please enter the number of the month : 3 Please enter the 4-digit year : 1999 Please enter the day : 1 The Julian date for 3/1/1999 is 60 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 1 Please enter the number of the month : 3 Please enter the 4-digit year : 2004 Please enter the day : 1 The Julian date for 3/1/2004 is 61 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 2 Current month : Please enter the number of the month : 9 Current year Please enter the 4-digit year : 2000 Current day Please enter the day : 27 Birth month Please enter the number of the month : 9 Birth year Please enter the 4-digit year : 1949 Birth day Please enter the day : 29 Your age is 50 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 2 Current month : Please enter the number of the month : 9 Current year Please enter the 4-digit year : 2000 Current day Please enter the day : 29 Birth month Please enter the number of the month : 9 Birth year Please enter the 4-digit year : 1949 Birth day Please enter the day : 29 Your age is 51 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 3 Please enter the number of the month : 8 Please enter the 4-digit year : 1980 Please enter the day : 23 The sign for 8/23 is Virgo 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 3 Please enter the number of the month : 7 Please enter the 4-digit year : 1950 Please enter the day : 4 The sign for 7/4 is Cancer 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 5 Sorry 5 is not a valid response 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 3 Please enter the number of the month : 14 Sorry, the month should be between 1 and 12 Please enter the number of the month : -1 Sorry, the month should be between 1 and 12 Please enter the number of the month : 4 Please enter the 4-digit year : 00 Sorry, the year should be between 1000 and 9999 Please enter the 4-digit year : 1936 Please enter the day : 36 Sorry, the day must be between 1 and 30 Please enter the day : 14 The sign for 4/14 is Aries 1 - What's the Julian Date 2 - What's My Age 3 - What's My Sign 4 - Quit Enter choice : 4 ecs225d-sgi-01[103]

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

Please be aware that this is definitely NOT a complete test of the program. Your testing should be much more extensive.

Submitting the Program

You are to use seperate compilation for this project, so you will be submitting three files.
Your C source code file that contains main() MUST be called proj1.c. The file which contains the function definitions MUST be called dates.c and the header file MUST be called dates.h

To submit your project, type the following at the Unix prompt. Note that the project name starts with uppercase 'P'.

submit cs201 Proj1 proj1.c dates.c dates.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'00 | lectures | news | help

Wednesday, 27-Sep-2000 13:32:27 EDT