Circle properties
Back to Main Page
This week, you will begin to write your own VB programs 'from scratch' - you will need a pencil and some rough paper to plan your code.

These exercises are centred around the properties of a circle

Some maths revision:

For all circles, we can use the following formulae:

Circumference = 2 x pi x radius         (Use 3.142 for pi)
Area = pi x radius x radius


Task 1

Write a program which does the following:

- asks the user to enter the radius of the circle as an integer (whole number)
- calculates the circumference of the circle
- outputs the answer on a form with an appropriate message
   e.g. The circumference of the circle is .......

Task 2

Write a program which does the following:

- asks the user to enter the radius of the circle as an integer (whole number)
- calculates the area of the circle
- outputs the answer on a form with an appropriate message
  

Hints:
- Remember that VB uses the asterisk (*) for the multiplication sign, not the letter 'x'
- Remember that a whole number input as the radius will cause the answer   to area to be a number with figures after a decimal point (a decimal)
e.g. Area of circle with radius 2 = 6.284
Which type of variable allows numbers after the decimal point?

- Remember that this problem is similar to the
VAT calculation example - use that as a template if you are unsure about the coding.

Save both programs to floppy disk
Print out a copy of your code for both tasks
Hosted by www.Geocities.ws

1