Dim j = 0
While j = 0
j = j - 1
Console.Write(“Hello”)
j = j + 1
End While
Question: If this code is executed, How many times will “Hello” be printed out?
Given three integers j, k and m
Build a function (in any development language) called SeqSummation, that calculates the sequence of summation as per:
j + (j + 1) + (j + 2) + (j + 3) + … + k + (k − 1) + (k − 2) + (k − 3) + … + m
Explanation: increment from j until it equals k, then decrement from k until it equals m.
Function Description
Create the function SeqSummation.
SeqSummation takes the following parameter(s):
• j integer
• k integer
• m integer
Program Output
• the value of the sequence sum
Example
• SeqSummation (5,9,6)
• i = 5, j = 9, k = 6
• Sum all the values from i to j and back to k: 5 + 6 + 7 + 8 + 9 + 8 + 7 + 6 = 56.
• Output: 56
Question
Description: Write a sorting function, that takes in an array of numbers (size n) and outputs the array of numbers as a list, in sorted sequence (highest value to lowest value)
Notes:
• Use any development language you wish
• Do not use any language’s in-built sorting function (example Javascript array.sort). We’re asking you to write the full sorting algorhythm yourself
Example
• simpleSort({1,2,3,4})
Output:
• 4,3,2,1
Question 8b. Bonus: Name the sorting algorhythm
For x = 0 To 100
For y = 5 To -10 step -1
If y = 0 Then
Exit For
End If
Console.Write("Hello")
Next
If x > 10 Then
Exit For
End If
Next
Question: If this code is executed, How many times will “Hello” be printed out?
) Put a button titled Open Answers File. When this button is clicked; open Answer.txt, and read and store the answers in an array of Strings. Close this file.
Answer the following questions about the following initialized array: Dim strSeafood(8) as String.
a. Assign Oysters to the first array location. What is the index number?
b. Assign Lobster to the fourth location in the array. What would the assignment statement look like?
c. What value does strSeafood.Length have?
d. How many types of seafood can this array hold?
e. What would happen if you assigned strSeafood(9) = “Red Snapper”?
Write a VB program to calculate the wages based on different rates (Normal hours and Overtime rates).
Write a FUNCTION to calculate the wages based on the following condition:
-Normal Hours: RM 10 per hours
-Overtime: RM 15 per hours
NOTE: The function should pass in a value of hours as Double, and a value of type as String. The function should return the calculated amount of wages and return as a Double.
*set the Enabled properties of the Total Wages Text Box to False
Tsegofatso Gift shop sells categorized products or items as gifts to various clients. The shop needs a VBA application that will enter all products that they sale and records them in an Excel worksheet. The owner wants to use a VBA userform for data entry.
The application must have a module and userform.
Module
On the module create the following functions and a sub: function calcVaT, function unitPrice and sub bubbleSort
• Function calcVat: this function calculates the tax charged from the selling price. It uses a parameter to receive the selling price. The tax rate is 15%
• Function unitPrice : this function calculates the actual product price before tax is added. It uses a parameter to receive the selling price.
• Sub bubbleSort : this sub receives the array of categories as a parameter and sorts it in an ascending order.