CSC 230: The Week beginning Oct. 11 |
If you use a source (book or web site), cite your source. (The sites http://whatis.techtarget.com/ and http://www.webopedia.com/ are decent sources for technical definitions.)
Give an example of Visual Basic code that
State Capital Quiz (Instructions for this week's
homework.)
StateCapitalHeadStart.txt
UserIndex = Array.IndexOf(Username, txtUsername.Text.ToLower.Trim.Replace(" ", ""))
FirstName.ToUpper.Substring(2, 1)takes a string variable called FirstName and capitalizes all of the letters (ToUpper) and then makes a substring -- a part of a string -- starting at the third position (the letter with an index of 2 where we started with index 0) which has a length of one. This is the third letter. Find the IndexOf that letter in the Letter Array (see below), then use the first silly name with the same index (Poopy1, see below). (If the person's name was not long enough, choose an index at random.) Finally concatenate the two silly names derived from the user's last name.
Dim Poopy1 As String() = New String() {"poopsie", "lumpy", "buttercup", "gidget", "crusty", _ "greasy", "fluffy", "cheeseball", "chim-chim", "stinky", _ "flunky", "booger", "pinky", "zippy", "goober", "doofus", _ "slimy", "loopy", "snotty", "tulefel", "dorkey", "squeezit", _ "oprah", "skipper", "dinky", "zsazsa"} Dim Poopy2 As String() = New String() {"diaper", "toilet", "giggle", "burger", "girdle", "barf", _ "lizard", "waffle", "cootie", "monkey", "potty", "liver", _ "banana", "rhino", "bubble", "hamster", "toad", "gizzard", _ "pizza", "gerbil", "chicken", "pickle", "chuckle", "tofu", _ "gorilla", "stinke"} Dim Poopy3 As String() = New String() {"head", "mouth", "face", "nose", "tush", "breath", "pants", _ "shorts", "lips", "honker", "butt", "brain", "tushie", _ "chunks", "hiney", "biscuits", "toes", "buns", "fanny", _ "sniffer", "sprinkles", "kisser", "squirt", "humperdinck", _ "brains", "juice"} Dim Letter As String() = New String() {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", _ "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}