>
CS 1323 Honors, Fall 1996

Individual Project 9

Data Entry - C Implementation

Due Tuesday, November 26, 4:30pm

What to Hand In

Project 9A

Write a program that prompts for a city, state, and zipcode to be entered from the keyboard, then displays it on the screen in standard form.

The city/state/zip may be entered in one of two forms:

standard
city, two-letter-state-code zipcode
Example:
Lawrence, KS 66046
long
city, state zipcode
Example:
Lawrence, Kansas 66046

The state will be one of those in the five-state region: Oklahoma, Kansas, Missouri, Arkansas, and Texas. States entered in the long form will be fully spelled out. The comma will be present to separate the city and state portions, and the zipcode will always be present. These forms, along with their variations described below, are the only forms of data your program is required to deal with.

States and their two-letter codes may be all capital letters, all lower case, or any combination (for example, OK, Ok, ok, and oK are all equivalent entries for the Oklahoma state code).

Regardless of the form in which the city/state/zip is entered, it must be displayed in standard form, with the two-letter code for the stat in all caps. Display cities in whatever form they are entered.

Package the interaction in a function call cityIO. This function will have no arguments, nor will it deliver a result.

The file UnitedStates.lhs, available under Supplied Software on the CS1323h Web site, contains a module that defines a sequence of strings naming the states and another that gives their two-letter codes. You can look up the two letter codes for the states in the five state region in that module.

Project 9B

Write a program that prompts for a clothing catalog item to be entered from the keyboard, then displays it on the screen in standard form.

standard form
item-name, color size price
Example:
oxford-cloth shirt, red L 12.95

Colors will be described by a single word (e.g., red, orange, yellow, etc.). Possible sizes are S, M, L, XL, and XXL, and these may be spelled out as small, medium, large, extra-large, and double-x.

The item-name will contain one or more words, and the only comma in the entry will be the one following the item name.

Any part of the entry may be all capital letters, all lower case, or any combination. For example, the color red can be entered in eight different ways: red, Red, RED, rED, ReD, rEd, REd, or reD. Orange is even worse, of course.

These forms are the only forms of data your program is required to deal with.

In standard form, capitalization within the item-name must be as entered. However, color in standard form is all lower case, and size is all caps. Regardless of the form in which the date is entered, it must be displayed in standard form.

Package the interaction in a function call itemIO. This function will have no arguments, nor will it deliver a result.

Project 9C

Write a program that prompts for a date to be entered from the keyboard, then displays that date on the screen in standard form.

standard
month day, year
Example: December 19, 1996
numeric
month/day/two-digit-year
Example: 12/19/96

The month portion of a date entered in standard form may be all capital letters, all lower case, or any combination. It will be fully spelled out. In numeric form, days and months expressible in one digit will be entered that way.

These forms are the only forms of data your program is required to deal with.

Regardless of the form in which the date is entered, it must be displayed in standard form without abbreviations and with the first letter of the month capitalized and the remaining letters lower case.

Package the interaction in a function call dateIO. This function will have no arguments, nor will it deliver a result.

Ground Rules