Sie sind auf Seite 1von 2

FACULTY OF ENGINEERING AND THE BUILT

ENVIRONMENT
Department of Electrical & Electronic Engineering Technology

Algorithms/Programming 1B (ALGELB1) | Practical Test 1

DATE: 31 August 2018 | TIME: 59 Minutes

Student No

Surname & Initials

Student Signature

Marks Percentage
Total
Marks 50 100%

Student
Score

Examiner: Dr. C. Chabalala


Moderator: Dr. A. Ali

Instructions
 Use comments in your programs where necessary.
 Programs’ structure and indentation must be clearly aligned.
 This paper has 2 printed pages including the cover page.

Page 1 of 2
A telecommunications company has requested you to write a program that can be used
to determine the coverage area for base transceiver stations (BTS). This is based
on determining the location of the transceiver, and the location at which signal
can be received from the transceiver. The following formula gives the distance

between any two points, ( x 1 , y 1) and (x 2 , y 2) in the Cartesian plane:

Distance = √(x −x ) +( y − y )
2 1
2
2 1
2

Given the location of the transceiver and the point at which signal can be
received, you can use this formula to find the radius of the coverage area by the
transceiver. Write a program that prompts the user to enter the location of the
transceiver, and the point at which signal can be received. The program should then
output the radius, diameter, circumference and the area covered by the transceiver.
Your program must have at least the following functions:

a) Input(): This function takes as its parameters, the four numbers that
represent the two points for location. This function is called from the
main() function to prompts the user to enter the four numbers, based on which
the parameters for the two locations are updated accordingly.

b) Distance(): This function takes as its parameters, the four numbers that
represent two points in the plane and returns the distance between them.

c) Radius(): This function takes as its parameters, the four numbers that
represent the transceiver location and a point at which signal can be
received. This calls the function Distance() to find the radius of the
coverage area, and returns the radius.

d) Diameter(): This function takes as its parameter, a number that represents


the radius of the coverage area and return the diameter.
(NB: diameter = 2 x radius).

e) Circumference(): This function also takes as its parameters, a number that


represents the radius of the coverage area and returns the circumference.
(NB: circumference = 2π x radius).

f) Area(): This function takes as its parameter a number that represents the
radius of the coverage area and returns area covered by the signal.
(NB: area = π x radius x radius)

Assume that the value of PI is given by: π = 3.1416

Page 2 of 2

Das könnte Ihnen auch gefallen