BYU Home pageBRIGHAM YOUNG UNIVERSITY
  Humanities Technology and Research Support Center
Back     DigHT LiveCode Gateway

DigHT 310
Structures Assignment - Key


The following are suggested  solutions to the three problems. There is usually more than one way to solve any programming problem.

1. Put the employee names into a container
Put the nicknames into a container
Set a counter to 1
Do the following as many times as there are names in the employee container
Choose and remember a nickname at random from the nickname container
Delete that nickname from the nickname container
Put a space and the nickname right after the first name of employee number (number in the counter)
Add one to the counter

2. Put the sentences into a container.
Create a container for the James sentence.
Create a container for the Betty sentence.
Do the following once for each of the sentences
if "James" is in the sentence
   if the James container is empty put the whole sentence, minus the period into it;
   otherwise, put a comma and the last word of the sentence at the end of the James container
if "Betty" is in the sentence
   if the Betty container is empty put the whole sentence, minus the period into it;
   otherwise, put a comma and the last word of the sentence at the end of the Betty container
Put the word "and" and a space right before the last word in each container
Put a period at the end of each sentence

3. Put the nouns in a container
Put the irregular forms in a container
Create a text entry field for the singular noun and one for the plural form.
Type any noun in the singular text field.
Do the following to form the plural:

Look for the noun in the irregular container
If the noun is there
  Get the second item of the line you found it on
  The second word is the plural
  
Otherwise, if the noun is not there
 If the noun ends in a vowel, add "k"
 Otherwise, (if the noun ends in a consonant)
     If the last letter is "k" double it to "kk"
    Add "ik" to the noun

Put the plural form into the plural text field.


Back     DigHT LiveCode Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University