CMPT110_Assignment05

# CMPT110_Assignment05 - how to remove the last hyphen 5...

This preview shows page 1. Sign up to view the full content.

CMPT 110 – Assignment 5 (1% of final grade) Due: Monday October 20th, in class Late assignments will not be accepted. What to hand in : a print-out of your code and one screenshot of your program. For each question , make the appropriate buttons and textboxes on your form to test what the question asks for. 1. Write a sub that will output the first 20 multiples of 5 into a textbox (5, 10, …100). You must use a loop. 2. Write a function that calculates the following, for any value of n : n i i= 1 (this means 1 * 2 * 3 * … * n) 3. Write a function that multiplies a string by an integer. For example, “ace” multiplied by 3 would give “aceaceace”. 4. Write a function that puts a hyphen (-) between each character of a string (e.g. “egg” becomes “e-g-g”). Hint: first, figure out how to put a hyphen after each letter (“e-g-g-”), then figure out
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: how to remove the last hyphen. 5. Write a function that counts the number of punctuation characters in a string. To determine if a character in a string is punctuation, you can do this: Dim s as String = “mr. tickle” If Char.IsPunctuation(s(0)) Then 'False – “m” is not punctuation If Char.IsPunctuation(s(2)) Then 'True – “.” is punctuation 6. Write a function that determines if a string is all upper case. To determine if a character in a string is upper case, you can use the Char.IsUpper() function, which works much the same as the Char.IsPunctuation() function above. 7. Write a function that puts a string into alternating upper and lower case letters. For example “fuDGe” would become “FuDgE” and “ms. world dictator” would become “Ms. WoRlD dIcTaToR”....
View Full Document

## This note was uploaded on 10/12/2011 for the course CMPT 110 taught by Professor Andrew during the Fall '10 term at Simon Fraser.

Ask a homework question - tutors are online