FloridaTech - College of Engineering

CSE1001 - LABORATORY


To be submitted in the lab

Part 1

Problem

Write an Ada program that will input a two letter abbreviation for one of the 50 states and print out the full name of the state. If the abbreviation isn't valid, the program should print an error message and ask for an abbreviation again. The names of the 50 states and their abbreviations are :

   State      Abbreviation      State         Abbreviation
Alabama          AL           Kentucky          KY
Alaska           AK           Louisiana         LA
Arizona          AZ           Maine             ME
Arkansas         AR           Maryland          MD
California       CA           Massuchusetts     MA
Colorado         CO           Michigan          MI
Connecticut      CT           Minnesota         MN
Delaware         DE           Mississippi       MS
Florida          FL           Missouri          MO
Georgia          GA           Montana           MT
Hawaii           HI           Nebraska          NE
Idaho            ID           Nevada            NV
Illinois         IL           New Hampshire     NH
Indiana          IN           New Jersey        NJ
Iowa             IA           New Mexico        NM
Kansas           KS           New York          NY
North Carolina   NC           Tennessee         TN
North Dakota     ND           Texas             TX
Ohio             OH           Utah              UT
Oklahoma         OK           Vermont           VT
Oregon           OR           Virginia          VA
Pennsylvania     PA           Washington        WA
Rhode Island     RI           West Virginia     WV
South Carolina   SC           Wisconsin         WI
South Dakota     SD           Wyoming           WY

Output

Enter the abbreviation of the state:         <------First prompt
CT                                           <------Entered by the user
The State is Connecticut                     <------Output
Enter the abbreviation of the state:         <------Second prompt
CU                                           <------Entered by the user
ERROR:No state exists with this abbreviation <------Output

Helpful Stuff:
Hint: Use nested case statements, where the outer case statement uses the first letter of the abbreviation as its selector.
Example Of Case Statement

Things to be turned in :
1. Source code
2. The output of the program


Part 2

Problem

Write an Ada program that performs a display test. The program should write lines containing the lower- and uppercase characters. Each line should begin with the successor of the character that began the previous line and contain 80 characters.The program should take as input the character from which the test should be started and the number of lines it should print. The character from which the test is to be started and the number of lines to display should be command line parameters.

Example :


If the filename is Scr_Test.adb. After compiling and building the program. Execute the program from the RUN of the Start button by typing in

Scr_Test f 5

Output:

fghijklmnopqrstABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM
NOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmno
pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ
RSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrs
tuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU
VWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw

Helpful Stuff:
Example Of Command Line Parameters
Example to convert string to integer


Professor:Dr.Stansifer
G.S.A : Rishi Gupta
Last Modified :3/19/99