Computer Science Programming by e Mlambo
Computer Science Programming by e Mlambo
SECTION A
PROGRAMMING
1. Design an interface for a program which prompts the user to enter the height and base of
a triangle and then add the code that will calculates the area of the shape [10]
2. Design an interface for a program which prompts the user to enter the length and width of
a rectangle and then add the code that will calculates the area and the perimeter of the
shape [15]
3. Design an interface for a program which prompts the user to enter the side (a), side
(b)and the height of a trapezium and then add the code that will calculates the area of the
shape [10]
4. Design an interface for a program which prompts the user to enter the radius of a circle
and add the code that will calculates the area [10]
NB pi=3,14
5. Design an interface and write a program to read month (1-12) and 4digited year and
display total days in given month and year. Write a program to read month (1-12) and
4digited year and display total days in given month and year. [15]
6. Design an interface and write a code for a program to find prime number between range
of start number and end number.
Input Start Number = 1
End Number = 20
Output: Prime numbers from 1 to 20 are 1 2 3 5 7 11 13 17 19 5. [15]
7. Write a program to find out twin prime numbers between 10 to 1000. Twin primes are
defined to be two consecutive odd numbers, which are prime. e.g.: 11 and 13, 17 and 19
are twin prime numbers.[10]
8. Design an interface and code the program which uses length function to return an integer
value which is the length of a phrase or a sentence, including the empty spaces.[13]
9. This question calculates the commission based on sales volume attained. Let's say the
commission structure is laid out as in the table below:
<5000 0
5000-9999 5
1000-14999 10
15000-19999 15
Insert a textbox to accept sale volume input and a label to display commission. Insert a
command button to trigger the calculation. [25]
10. In this question, we use the Select Case statement to guess a number generated randomly.
The user is supposed to enter his/her number which will be compared with the guessed
number to determine the below
11. Design the interface like below and add the code to compute the interest
12. Set up a form with one textbox to enter the amount in dollars to be converted into pounds,
euro and yen the converted amounts must be outputted in labels.
NB 1 dollar =0.68 pound
1 dollar= 0.83 euro
1 dollar=108.36 yen [15]
13. Create an application that converts Celsius to Fahrenheit using the below formular
F=1.8 * C + 32 [15]
14. Mlambo Company manufactures widgets that weigh 9.2 kg each hence design an
interface which allows the user to enter the number of widgets in a pallet an calculates the
weight and output [10]
15. Create a Vb application that allows the user to enter a cars speed in miles per hour and
calculates the distance it will cover on given hours [15]
16. Design an interface and code a program that will allow a user to enter a text word and if
the text word its length is greater than 10 characters the program must display an error
message saying the entered text word is too long [15]
17. Create a Vb application and design the interface to allow the user to enter the numeric
value between 1 and 10 then code the program to determine the Roman Numeral value of
the entered number using the Case Statement or If statement [15]
18. Write an application that accepts from the user the wholesale cost of an item and its
markup percentage, the program must calculates its retail price [15]
19. The equation d=1/2gt2 is used to calculate the distance the object falls in a specific time
period
d= distance
g=gravity
t= time
Hence create a Vb application that will calculates the distance that the object fell.
Thank you
Check second sample