Homework

(Not required to submit)

How would you display text directly on a form?

Assume you just placed a label box on the form. How will you place a string within that box? a number? (use proper programming precautions we discussed in class).

Write a statement to show “The Sum is 28” in a pop up window. Note: The value of sum is contained in the variable sum.

Write a statement to read the value for firstNum using an pop up input box

Using examples describe the deference between a label and a text box.

Show how to read exam grades using an input box and terminate reading when a sentinel value is entered. Keep a running and total and find the average of these grades. Assume you have a button to trigger the event to do this. code

Suppose you have an array of string of 80 characters each to print. You only want to print 66 lines per page. Once you have printed 66 lines you want to issue a form feed (ASCII – 12). Using the mod how will you able to accomplish this? Code

Differentiate between a class and an object. Create an object of a class called CalcSqFt having a constructor.

Show how to define a class (you may write the CalcSqFt, or the GradeBook class we wrote in class)

Explain Common Language Runtime

Write a VB module to accomplish the following.

Declare variables sum and number to be of type Integer.

Assign 1 to variable number

Assign 0 to variable sum

Total variables number and sum, and assign the result to variable sum

Print “The sum is: “ followed by the value of variable sum to the command prompt.

Write a function to calculate interest for one day given annual percentage rate and principle. code

Given an initial deposit of $1000.00, call the above function 365 times (for one year). The interest should be added to the principle each day. A fixed amount of deposit ($100.00) should be made every 30 days. Display the initial deposit, interest earned for the year, total of monthly deposits and final principle. Code

Suppose you have two buttons, print and save to file. Show how to print your name, address and telephone number directly to the printer and to a file. Code

Using while wend show how to accept name, address and telephone number of an unlimited number of people. Terminate the loop with a sentinel value. code

Compare and contrast the various looping structures available in visual basic.

What is a visual basic code module? When would you use it? How would you add a code module? Write a code module to read names of 52 cards into an array from a file.

Change the following if then else statements to select case [5]

If grade >=90 then

write (“A”)

ElseIf grade >=80 then

write(“B”)

ElseIf grade >= 70 then

write(“C”)

Else

write(“D”)

End If

Write a VB loop using While/End While to calculate ending principle if the initial investment was $2,000.00 with daily compounded interest rate of 8%.

Write a nested loop to display multiplication tables.

Design a structure chart for the carpet program (it must be as I described in class, any other description will not be accepted.)

Using your structure chart write a subroutine that has parameters of byVal and byRef.

Using your structure chart write a function.

Write a recursion program to calculate factorial.

Show how to open a text file to write, send “Hello World!” to it, and close it.