0% found this document useful (0 votes)
40 views

Programming Example

This program illustrates the use of programming logic units studied in a semester. It was created by Cheril Grimmett on April 24, 2015 and modified by Jeffrey Braswell on April 28, 2015. The program calculates order subtotals, discounts, and totals based on product codes entered. Users can enter quantity and price, select a product code, then the program performs calculations and displays the subtotal, discount (if any), and total.

Uploaded by

api-285445008
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Programming Example

This program illustrates the use of programming logic units studied in a semester. It was created by Cheril Grimmett on April 24, 2015 and modified by Jeffrey Braswell on April 28, 2015. The program calculates order subtotals, discounts, and totals based on product codes entered. Users can enter quantity and price, select a product code, then the program performs calculations and displays the subtotal, discount (if any), and total.

Uploaded by

api-285445008
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

'Project:

'Purpose:
'Created by:
'Modified by:

RMO case project


illustrates use of all units of programming logic studied this semester
Cheril Grimmett on 4/24/15
Jeffrey Braswell on 4/28/15

Option Explicit On
Option Strict On
Option Infer Off
Public Class mainForm
Private Sub exitButton_Click(sender As Object, e As EventArgs) Handles exitButton.Click
Close()
End Sub
Private Sub resetButton_Click(sender As Object, e As EventArgs) Handles resetButton.Click
qtyTextbox.ResetText()
priceTextbox.ResetText()
vcodeTextbox.ResetText()
subtotalLabel.ResetText()
discountLabel.ResetText()
totalLabel.ResetText()
qtyTextbox.Focus()
End Sub
Private Sub calcButton_Click(sender As Object, e As EventArgs) Handles calcButton.Click
'Declare Variables
Dim
Dim
Dim
Dim
Dim

quantity As Integer
price As Single
vCode As String
discount As Decimal
subTotal As Single

While Not IsNumeric(qtyTextbox.Text)


qtyTextbox.Text = InputBox("Please enter a valid number for quantity")
End While
While Not IsNumeric(priceTextbox.Text)
priceTextbox.Text = InputBox("Please enter a valid number for quantity")
End While
quantity = CInt(qtyTextbox.Text)
price = CInt(priceTextbox.Text)
vCode = CStr(vcodeTextbox.Text).ToUpper
subTotal = (quantity * price)
Select Case vCode
Case Is = "S"
discount = CDec((subTotal
Case Is = "H"
discount = CDec((subTotal
Case Is = "F"
discount = CDec((subTotal
Case Is = "C"
discount = CDec((subTotal

* 0.2))
* 0.35))
* 0.25))
* 0.2))

Case Is = "T"
discount = CDec((subTotal * 0.45))
Case Is = "W"
discount = CDec((subTotal * 0.22))
Case Else
discount = 0
End Select
'Perform Calculations
subtotalLabel.Text = (quantity * price).ToString("N2")
discountLabel.Text = discount.ToString
If discount = 0 Then
totalLabel.Text = CStr(subTotal + 12)
Else
totalLabel.Text = CStr(subTotal - discount)
End If
End Sub
End Class

You might also like