In: Computer Science
programming language is in excel VB8
Program 2: Software Sales A software company sells three packages, Package A, Package B, and Package C, which retail for $99, $199, and $299, respectively. Quantity discounts are given according to the following table: Quantity Discount 10 through 19 20% 20 through 49 30% 50 through 99 40% 100 or more 50% Create an application that allows the user to enter the number of units sold for each software package. The application should calculate and display the order amounts and the grand total. ENGR 1100 Asignación #2 - DECISIONS Deadline: Lunes 19 de octubre 2020, 11:50pm Input validation: Make sure the number of units for each package is not negative. Use the following test data to determine if the application is calculating properly: Units Sold Amount of Order Package A: 15 units Package A: $1,188.00 Package B: 75 units Package B: $8,955.00 Package C: 120 units Package C: $17,940.00 Grand Total: $28,083.00
programming language is in excel VB8
Program:
Public Class Form1
'Calculate button calculates the order details for each 'package
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
'Declare the variables for calculation
Dim pacA As Double = 99
Dim pacB As Double = 199
Dim pacC As Double = 299
Dim valA As Double
Dim valB As Double
Dim valC As Double
Dim packageA As Integer
Dim packageB As Integer
Dim packageC As Integer
packageA = CInt(TxtPacA.Text)
packageB = CInt(TxtPacB.Text)
packageC = CInt(TxtPacC.Text)
lblResult.Text = ""
'If condition to check the inputs from user for 'package A
If IsNumeric(packageA) And packageA > 0 Then
'Select Case statement for package A
Select Case (packageA)
Case Is > 100
valA = (pacA - (pacA * 0.5)) * packageA
Case 10 To 19
valA = (pacA - (pacA * 0.2)) * packageA
Case 20 To 49
valA = (pacA - (pacA * 0.3)) * packageA
Case 50 To 99
valA = (pacA - (pacA * 0.4)) * packageA
End Select
'If condition to check the inputs from user for 'package B
If IsNumeric(packageB) And packageB > 0 Then
Select Case (packageB)
'Select Case statement for package B
Case Is > 100
valB = (pacB - (pacB * 0.5)) * packageB
Case 10 To 19
valB = (pacB - (pacB * 0.2)) * packageB
Case 20 To 49
valB = (pacB - (pacB * 0.3)) * packageB
Case 50 To 99
valB = (pacB - (pacB * 0.4)) * packageB
End Select
'If condition to check the inputs from 'user for package C
If IsNumeric(packageC) And packageC > 0 Then
Select Case (packageC)
'Select Case statement for package C
Case Is > 100
valC = (pacC - (pacC * 0.5)) * packageC
Case 10 To 19
valC = (pacC - (pacC * 0.2)) * packageC
Case 20 To 49
valC = (pacC - (pacC * 0.3)) * packageC
Case 50 To 99
valC = (pacC - (pacC * 0.4)) * packageC
End Select
'Display the order amount, total 'amount in the resultant label
lblResult.Text = "Package A:" & FormatCurrency(valA) & vbCrLf & "Package B:" & FormatCurrency(valB) & vbCrLf & "Package C:" & FormatCurrency(valC) & vbCrLf & "Grand Total:" & FormatCurrency(valA + valB + valC)
End If
End If
End If
End Sub
'Clear button clears the contents of packages
Private Sub btnClear_Click(sender As Object, e As ‘ EventArgs) Handles btnClear.Click
'Clear the contents
TxtPacA.Text = ""
TxtPacB.Text = ""
TxtPacC.Text = ""
lblResult.Text = ""
End Sub
'Exit button to close the application
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
'Close the form.
Me.Close()
End Sub
End Class
Sample Output: