A first VB program - the VAT calculator

This program will calculate the cost of an item with VAT using the following
algorithm:

1. Ask the user to enter the price without VAT added
2. Store the price
3. Calculate VAT at 17.5% (i.e. multiply the price by 0.175)
4.Calculate the total with VAT by adding the VAT to the original price
5. Display the total cost on the screen

Before starting, make sure that you have set up VB as outlined in the
'starting up' page.
Task 1 - double click on your Form to get the code window then type in the VB code shown between the lines Private Sub Form Load() and End Sub
Press              to run your program  - enter 100 for the item price.

You should get the answer 117.5 printed out on your form.
If your program does not run correctly you will get an error message - the code will be highlighted in yellow.
Make sure that you check your typing of the code VERY carefully for mistakes before calling your lecturer for help - 99% of mistakes are usually simple typing errors!
Task 2 - Examine each line of code carefully to see if you can tell what it does.
Go to the
VAT example page to check your understanding of the code
Back to Main Page
Task 3 - make the following changes to your code and test it to see that it runs correctly:

a) Change the VAT rate to 20% and test again using 100 - what answer    should you get?

b) Change the input box message to "Please enter the price without VAT"

c) Change the text on the output form to "The price with VAT is"

d) Add a line to the form saying "Program designed by (your name here)"

e) Save your program to floppy disk - remember you need to save the form
    AND the project

f) Print out a copy of your program to keep in your folder:
    File menu
-> Print -> select current module and code tick boxes -> OK


End of Tasks
Forms and Input Boxes

You have already used a form in the 'simple maths' program.
The form allows you to communicate with the user by:

- Giving them text instructions on what to do
- Displaying the results - the output from the program

Today's task will use forms in exactly the same way.
We will now introduce an input box to make the program easier to use.

The input box will:

- Display a message telling the user what they need to do
- Allow the user to type in a response to the instructions
- Save their response as a variable - put it in a named slot in memory
Hosted by www.Geocities.ws

1