Applications Programming --- Lab 4
Objective:
- Learn to develop a simple VBA program
References:
Problem Description
A farmer sets up a stand in the Farmer's Market and sell the following
things:
- Blueberry, $5.45 per pound;
- Apple, $1.79 per pound;
- Recipe Book, $7.99 for each copy.
Your Tasks:
- Download the Lab 4's template workbook file:
lab4-input.xlsx.
- Open the template file you just downloaded and design and
implement a VBA program that handles a transaction of a customer
for the farmer.
- Your program first collect the following information about
the transaction:
- the amount of blueberry (in pounds) purchased,
- the amount of apple (in pounds) purchased, and
- the number of copies of the recipe book purchased.
- Calculate the charge of the goods (sub-total) of the transaction
according to the information collected and the unit price
of each type of goods. There is an extra 5 percent GST tax charge
on the charge of the recipe book(s). The total charge of the
transaction is the sum of the sub-total and the GST tax
if there is any.
- Use a message box to show the final total charge.
- Enter the collected information, the charge of goods, the tax
and the final total charge to the appropriate cells in the active
row. You can assume that the Active Cell is placed on the first
column of the active row.
- Save your work to a Macro-enabled Excel (with the extension name
.xlsm).
When you develop your VBA program, you need to pay attention to
the following things:
- Did you use "Option Explicit" at the beginning of your program?
- Did you use named constants to represent any literal values?
- Did you give meaningful names to your variables and constants?
- Did you use appropriate messages when you show the calculation
result to the users?
- Did you remember to save data to Excel file in your program?
There is a weekly Assignment 4
following this lab.