Visual Basic 6

VBP Assignment
Mail Order
As a member of a development team involved in setting up the accounting and
financial systems for a new mail order business for household items, your task is to
develop an application to calculate the amount due for each order. The specifications
for the application are described below.

For an order, the user should enter the following information into text boxes:
customer name, address, city, state, and postal code. An order may consist of
multiple items. For each item, the user will enter the product description, quantity,
weight, and price into text boxes. You will need command buttons for Next Item,
Update Summary, Print, and Exi t.

For the Next Item button, validate the quantity, weight, and price. Each must be
present and numeric. For any bad data, display a message box. Calculate the charge
for the current item and add the charge and weight into the appropriate totals. Do not
calculate shipping and handling on individual items; rather, calculate shipping and
handling on the entire order.

When the Update Summary button is clicked, calculate shipping and handling, the general sales tax (GST), and the total amount due for the order. The GST is 7 percent
of the total charge and is charged only for shipments to a Singapore address.
The shipping and handling charges depend on the weight of the products. Calculate
the shipping charge as 25 cents per pound and add that amount to the handling charge
(taken from Table 1).

Display the entire amount of the bill in labels titled Dollar amount due, GST, Shipping
and handling, and Total amount due.

Table 1
Weight
Handing
Less than 10 pounds
$1
10 to 100 pounds $3.00
$3
Over100 pounds $5.00
$5


Notes:
Please include some comments in your program. As minimum comments, we would
like to see your name, assignment number, and program purpose at the top of the
main file. In addition, each procedure should have a short comment indicating its
purpose. You can place comments anywhere in your program by first typing the '
character. Everything on that line that follows this character is considered a comment
and is ignored by the compiler.


Option Explicit

Dani AI

Generated

This thread from describes a VB6 student project; has already flagged forum housekeeping. The fastest path to a working submission is to split the work into small, testable pieces: a compact data model for line items, a validation routine you can reuse, a routine that updates running totals, and a separate routine that formats the summary for display/printing.

Use a small class or UDT for a line item and store items in a Collection. Keep money in the Currency type to avoid rounding errors, and use FormatCurrency only when showing values on the form. Put all validation in one routine so the same checks run whether the user clicks Next Item or presses Enter.

Example class and helper (VB6):

' clsLineItem
Public Description As String
Public Quantity As Long
Public Weight As Double
Public UnitPrice As Currency

Public Function Amount() As Currency
    Amount = UnitPrice * Quantity
End Function
' Helpers on the form module
Private Function ToCurrencySafe(txt As String) As Currency
    If Trim$(txt) = "" Or Not IsNumeric(txt) Then
        Err.Raise vbObjectError + 1000, "ToCurrencySafe", "Numeric input required"
    End If
    ToCurrencySafe = CCur(Val(txt))
End Function

Checklist and pitfalls to watch for: always clear input fields and set focus after adding an item; guard against negative or zero quantities; accumulate weight and subtotal with Currency/Double as appropriate; do final rounding only when displaying; keep UI updates (labels) in one UpdateSummary routine so totals can be recalculated reliably. Add minimal comments at the top of modules and short headers on each procedure so graders can see purpose and flow.

Nice assignment...
Please Read This

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.