0% found this document useful (0 votes)
79 views4 pages

Women'S University in Africa: Addressing Gender Disparity and Fostering Equity in University Education

This document contains 6 questions related to programming in VB.Net. Question 1 asks to write a program to display an amortization schedule for a loan. Question 2 asks to write a program to calculate the percentage of calories from fat in a food item based on user input. Question 3 asks to write subprograms to find the largest/smallest values and sum/average of an array, and to reverse digits of a number. Question 4 asks to write programs to generate a multiplication table and explain properties of text boxes, option buttons, list boxes and combo boxes. Question 5 asks to write a procedure to display student details from an Access database based on an enrollment number. Question 6 asks to find and correct errors in code snippets calculating totals

Uploaded by

lloydmuya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views4 pages

Women'S University in Africa: Addressing Gender Disparity and Fostering Equity in University Education

This document contains 6 questions related to programming in VB.Net. Question 1 asks to write a program to display an amortization schedule for a loan. Question 2 asks to write a program to calculate the percentage of calories from fat in a food item based on user input. Question 3 asks to write subprograms to find the largest/smallest values and sum/average of an array, and to reverse digits of a number. Question 4 asks to write programs to generate a multiplication table and explain properties of text boxes, option buttons, list boxes and combo boxes. Question 5 asks to write a procedure to display student details from an Access database based on an enrollment number. Question 6 asks to find and correct errors in code snippets calculating totals

Uploaded by

lloydmuya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

WOMEN’S UNIVERSITY IN AFRICA

Addressing gender disparity and fostering equity in University Education

FACULTY OF MANAGEMENT AND ENTREPRENEURIAL DEVELOPMENT


STUDIES & INFORMATION TECHNOLOGY

BSc HONOURS DEGREE IN INFORMATION SYSTEMS

MAIN PAPER

IS122: VB.Net

INTAKE 13: FIRST YEAR SECOND SEMESTER

DATE: WEDNESDAY 04 JUNE 2014 TIME: 3 HOURS AFTERNOON

INSTRUCTIONS TO CANDIDATES

Answer Question 1 and any other three.

1
Question 1

The monthly payment for a given loan pays the principal and the interest. The monthly interest is
computed by multiplying the monthly interest rate and the balance (the remaining principal).
The principal paid for the month is therefore the monthly payment minus the monthly interest.
Write a program that lets the user enter the loan amount, number of years, and interest rate and
displays the amortization schedule for the loan.
Here is a sample run:

[40]

Question 2

The American Heart Association suggests that at most 30% of the calories in our diet come from
fat. Although food labels give the number of calories and amount of fat per serving, they often
do not give the percentage of calories from fat. This percentage can be calculated by multiplying
the number of grams of fat in one serving by 9, dividing that number by the total number of
calories per serving and multiplying the result by 100.
Write a program that request the name, number of calories per serving and the grams of fat per
serving as input, and tell whether the food meets the American Heart Association
recommendations. [20]

Question 3

a) Write a sub program to find the largest, smallest, sum and average number of array of ten
numbers. [12]
b) Write a VB procedure to reverse the digits of given number e.g. 1234 => 4321. [8]

2
Question 4

a) Assume you want to generate a multiplication table of any given number from 1 to 12. Write
a program that allows the user to enter the number and then generate the multiplication table.
The output of a number 3 should look like this:
1 x 3 = 3
2 x 3 = 6
.
.

12 x 3=36 [12]

b) Explain the following properties:


(i) MaxLength property of Text Box;
(ii) Value property of Option Button ;
(iii) ListCount property of List Box; and
(iv) List property of Combo Box. [8]

Question 5

Assume that there is a database titled “Student” in Microsoft Access. The database includes
address, name, and enrolment number of each student. Write a procedure that accepts enrolment
number as input and displays the student details as output. [20]

3
Question 6

Find errors and correct them:

a) Dim array As Integer() = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}


Dim total As Integer = 0

For i = 0 To array.GetUpperBound()
total += array(i)
Next

mgsbox("Total of array elements: " & total) [5]

b) Public Class frmInterest


Private Sub frmInterest _Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim Interest, AmtInvested As Decimal


Dim RateOfInterest As Short
Dim Year As Integer

Interest=CalculateInterest(AmtInvested, RateOfInterest, Year)

Public Function CalculateInterest(ByVal Principal As Decimal, ByVal_


InterestRate As Decimal,ByRef NumberOfYears As Integer)
Dim interest as decimal
Dim Year as integer

Interest = 0
For Year =1 to NumberOfYears
Interest = Interest+((Principal + Interest))+ InterestRate/100)
Next Year

End Sub
End Class [10]

c) Dim int rate = 1.5

Dim double price = 0.0

if(rate >= 0.0 and rate < 1.0)


price = 20 * rate
else (rate <= 1.0 and rate < 2.0)
price = 15 * rate
else (rate >= 2.0)
price = 10 * rate

msgbox(price) [5]

END

You might also like