CT243 lab2
http://geminga.it.nuigalway.ie/~gettrick/courses/CT243/labs/l2.html
-
For this lab you must submit
-
Handwritten development notes, including statement of the problem, analysis of the problem, algorithm design (which may include flow charts).
-
A printout of form, image and code of your program, and any numerical answers requested.
-
The above material should be given to David or left in the cardboard box marked CT243 in the mail room (room IT415) on the 4th floor of the IT Building
before
the deadline of 5pm
Monday 11th February 2008. You will lose 20% for each day
(or part of day) the lab is late.
-
Consider the two functions discussed in class,
Function powIT (ByVal a, ByVal, b)
and
Function powBINit (ByVal a, ByVal, b)
that use iteration to calculate ab where b is any
positive integer.
Modify both of these functions so that along with the answer they also
return the number of times the while loop has been executed. One way to do this
is, within the function to declare an array with two elements
Dim D(1) As Double
.
Then store the actual result (ab) in D(0) and the number of
times the while loop executes in D(1), and return the whole array
using
Return D
.
Set this up using the standard simple interface of text box, command button,
and click event that causes a message box to pop up with the two numbers.
According to your program, how many times is the while loop in
powBINit
executed for
-
713 ?
-
1397 ?
-
144179203 ?
-
A palindrome is a word that looks the same when spelled backwards. Examples
are deed, kayak, bib. Develop a program in VB .NET to calculate whether
or not a given input word is a palindrome. Your program should of course
output TRUE or FALSE. Write two separate functions
Function palIT(ByVal s as String)
Function palREC(ByVal s as String)
to do the calculation by iteration or by recursion.
©
NUI, Galway