Hartismere School

An outstanding coeducational secondary school and sixth form college

Programming: String manipulation - Sci-fi name generator

The user enters their first name and then their surname.
Your program program should then:

  1. Take the last letter of the surname
  2. Add an 'a'
  3. Add the first  3 characters of the first name
  4. Add an 'i'
  5. Add an 'l'
  6. Add the first 2 characters of the surname

The completed name should then be outputted to the user

Extension (character arrays and creating random numbers will be useful skills)

  1. In place of the original step 2, random select a letter from 'a', 'e', 'i', 'o' and 'u' to add.
  2. In place of the original step 4, random select a letter from 'a', 'e', 'i', 'o' and 'u' to add.
  3. In place of the original step 5, random select a letter from 'd', 'g', 'j', 'k', 'l', 'p', 't' and 'z' to add.
  4. In place of the original step 3, IF the first name is greater than 5 characters in length, add the first 3 characters. Else use the first 2 characters and the last character of the first name.
  5. Amend your solution to extension step 3 so that if randomly choices between adding 1 or 2 of the selected character. 
  6. If you have completed all of the above, create your own system for generating a surname to go with the generated first name

At the end of the task (or lesson), add your code to your programming journal. Be sure to give a title and annotate.