Simpe Order Info

This is a simple program that computes the order with a take out checkbox and its price tax.



Source Code:

Public Class Form1
    Dim SubTotal, Total As Double
    Const cappuccino = 3
    Const espresso = 3.25
    Const latte = 2.85
    Const icedlatte = 4.25
    Const tax = 0.12
    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        Dim price, qty, taxs, itemamount As Double
        If RadioButton1.Checked = True Then
            price = cappuccino
        ElseIf RadioButton2.Checked = True Then
            price = espresso
        ElseIf RadioButton3.Checked = True Then
            price = latte
        ElseIf RadioButton4.Checked = True Then
            price = icedlatte
        ElseIf RadioButton5.Checked = True Then
            price = icedlatte
        Else
            MsgBox("Please select a drink.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "No Order")
        End If
        If IsNumeric(TextBox1.Text) Then
            qty = Val(TextBox1.Text)
            itemamount = price * qty
            SubTotal = SubTotal + itemamount
            If CheckBox1.Checked = True Then
                taxs = FindTax(SubTotal)
            End If
            Total = SubTotal + taxs
            lblItemAmount.Text = FormatCurrency(itemamount)
            lblSubTotal.Text = FormatCurrency(SubTotal)
            lblTax.Text = FormatCurrency(taxs)
            lblTotal.Text = FormatCurrency(Total)
        Else
            MsgBox("Quantity must contain number.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Invalid")
            TextBox1.Focus()
        End If
    End Sub

    Private Function FindTax(ByVal Amount As Double) As Double
        FindTax = Amount * tax
    End Function
    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        TextBox1.Clear()
        RadioButton1.Checked = False
        RadioButton2.Checked = False
        RadioButton3.Checked = False
        RadioButton4.Checked = False
        RadioButton5.Checked = False
        CheckBox1.Checked = False
        lblItemAmount.Text = ""
        lblSubTotal.Text = ""
        lblTax.Text = ""
        lblTotal.Text = ""
        TextBox1.Focus()
        SubTotal = 0
        Total = 0
    End Sub
End Class

DOWNLOAD LINK: OrderInfo.rar
Simpe Order Info Simpe Order Info Reviewed by code-dev on 4:44 PM Rating: 5

No comments:

Powered by Blogger.