B
beccak0316
Guest
Hey Everyone,
here is the scenario:
(1) txt – for text boxes
(2) lbl – for labels that you program
(3) btn – for command buttons
(4) opt – for radio buttons
(5) chk – for check boxes
(6) pic – for picture boxes
(7) (etc.)
(1) A string data type should be used to enter an item name.
(2) An integer should be used to enter the quantity of the item purchased.
(3) A decimal value should be used to enter the price of an individual item.
(4) When the user loads the form, all values should be blank (not zero).
(5) Place the items on the left side of the form in one group.
(6) Place the items on the right side of the form in another group.
(7) Create another label similar to the title label created up above.
(a) This label should be placed on the bottom right side of the form and should not be too big.
(b) Set the Autosize of this label to False as you did in the other label you created earlier.
(c) This label should have 3 lines of character in it. The characters on the 3 lines should say:
Your Full Name (substitute your own real full name)
VBLabx (substitute the “x” with the lab number
CSC208-xx (substitute the “xx” with your section number)
(8) When the user clicks on the Calculate This Item Total button, the following
should occur on the left side of the form for the individual item.
(a) The Item Subtotal should be calculated by multiplying the Quantity entered by the Item Price.
(b) The Item Sales Tax amount should be calculated by using a standard tax rate of 7 percent defined as a Constant and multiplying it by the Item Subtotal. You can assume for this lab assignment that all items will be taxed.
(c) The Item Total should be calculated by adding the Item Sales Tax amount and the Item Subtotal.
(d) Local variables should be used to calculate these values.
(9) When the user clicks on the Add This Item To Cumulative Totals button, the
following should occur on the right side of the form for the accumulated totals.
(a) All values on the right side of the form should keep accumulating until the “Exit Form” button is selected. This will allow multiple different items to be purchased and accumulated.
(b) A Count Of Different Items Purchased should be kept, adding one to the count for each different item purchased.
(c) An Accumulated Quantity should be kept, accumulating the total quantity of all the items purchased. This could be accumulating 5 of one item, 3 of another item, totaling 8 items so far, etc.
(d) An Accumulated Subtotal should be kept, accumulating the sum of all the subtotals calculated for all the Item Subtotals so far.
(e) An Accumulated Sales Tax should be kept, accumulating the sum of all the sales tax calculated for all the items purchased so far.
(f) A Final Total Amount Due should be kept, accumulating the sum of all the Item Totals calculated for all the items purchased so far.
(g) The Accumulated Subtotal and Accumulated Sales Tax should add up to the Final Total Amount Due.
(h) Module level variables should be used to calculate these values.
(10) Calculation values and formatting values:
(a) All decimal valued calculations should be done using single precision or decimal valued variables that can accommodate four significant positions to the right of the decimal to store data content.
(b) All output values that are decimal valued should be displayed using a currency format with two decimal positions.
(c) All output values that are integer valued should be displayed using an integer format.
(d) These would include individual item subtotals, sales tax, item totals, accumulated item subtotals, accumulated sales tax totals, final total amounts due, etc.
(11) When the Clear button is pressed:
(a) All the values in the left side of the form should be cleared, displaying blank text
boxes, so that another item’s data can be entered.
(b) The values on the right side of the form should remain the same and stay visible.
(12) When the Print Form button is clicked, a screen print of the current contents of the form
should be printed.
(a) When the Exit button is clicked, the current loaded form should be exited.
I am having trouble with mdecAccumulatedSubtotal = mdecAccumulatedSubtotal + decSubTotal().
Here is the rest of my code:
Option Strict Off
Option Explicit On
Public Class Form1
Rebecca Katz
CSC 208-58
Data submitted: 2/17/2016
VB Lab 3
This program will be introducing Visual Basic calculations as well as local variables and modular level variables
Declaring Variables
Dim mintCountItemsPurchased As Integer
Dim mintAccumQuantity As Integer
Dim mdecAccumulatedSubtotal As Decimal
Dim mdecAccumSalesTax As Decimal = 0.07
Dim mdecFinalAmountDue
Private Property mCdecountItemsPurchased As Integer
Private Sub btnCalcItemTotal_Click(sender As Object, e As EventArgs) Handles btnCalcItemTotal.Click
Try
Dim decSubTotal As Decimal
Dim intQuantity As Integer
Dim decItemPrice As Decimal
Dim dblSalesTax As Decimal
Dim dblItemTotal As Decimal
Const decSalesTax As Decimal = 0.07
Calculating values on left side of the form
decSubTotal = intQuantity * decItemPrice
lblQuantity.Text = intQuantity.ToString("s")
lblItemPrice.Text = decItemPrice.ToString("I")
dblSalesTax = 0.07 * decSubTotal
dblItemTotal = decSalesTax + decSubTotal
Catch
lblStatus.Text = "Invalid quantity or price"
End Try
End Sub
Private Sub btnAddItem_Click(sender As Object, e As EventArgs) Handles btnAddItem.Click
Calculating items ont the right side of the form
mintCountItemsPurchased = mintCountItemsPurchased + 1
mintAccumQuantity = mintAccumQuantity + 5 + 3
mdecAccumulatedSubtotal = mdecAccumulatedSubtotal + decSubTotal()
mdecAccumulatedSalesTax = mdecAccumulatedSalesTax + decSalesTax()
mFinalAmountDue = mdecFinalAmountDue
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
Clearing values from the left side of the form
intQuantity.Clear()
strItemName.Clear()
decItemPrice.Clear()
dblSubTotal.Clear()
dblSalesTax.Clear()
dblItemTotal.Clear()
End Sub
Private Function decSalesTax() As Object
Throw New NotImplementedException
End Function
Private Function mAccumSalesTax() As Object
Throw New NotImplementedException
End Function
Private Function decSubTotal() As Decimal
Throw New NotImplementedException
End Function
End Class
Continue reading...
here is the scenario:
- The following form should be built in Visual Basic:
Here is the scenario:
- Print the above sample form out
- Next to each control on the printed page with the form on it, hand write the name of the control name that you will use when building your form.
- Remember to use the proper prefix names for all controls such as:
(1) txt – for text boxes
(2) lbl – for labels that you program
(3) btn – for command buttons
(4) opt – for radio buttons
(5) chk – for check boxes
(6) pic – for picture boxes
(7) (etc.)
(1) A string data type should be used to enter an item name.
(2) An integer should be used to enter the quantity of the item purchased.
(3) A decimal value should be used to enter the price of an individual item.
(4) When the user loads the form, all values should be blank (not zero).
(5) Place the items on the left side of the form in one group.
(6) Place the items on the right side of the form in another group.
(7) Create another label similar to the title label created up above.
(a) This label should be placed on the bottom right side of the form and should not be too big.
(b) Set the Autosize of this label to False as you did in the other label you created earlier.
(c) This label should have 3 lines of character in it. The characters on the 3 lines should say:
Your Full Name (substitute your own real full name)
VBLabx (substitute the “x” with the lab number
CSC208-xx (substitute the “xx” with your section number)
(8) When the user clicks on the Calculate This Item Total button, the following
should occur on the left side of the form for the individual item.
(a) The Item Subtotal should be calculated by multiplying the Quantity entered by the Item Price.
(b) The Item Sales Tax amount should be calculated by using a standard tax rate of 7 percent defined as a Constant and multiplying it by the Item Subtotal. You can assume for this lab assignment that all items will be taxed.
(c) The Item Total should be calculated by adding the Item Sales Tax amount and the Item Subtotal.
(d) Local variables should be used to calculate these values.
(9) When the user clicks on the Add This Item To Cumulative Totals button, the
following should occur on the right side of the form for the accumulated totals.
(a) All values on the right side of the form should keep accumulating until the “Exit Form” button is selected. This will allow multiple different items to be purchased and accumulated.
(b) A Count Of Different Items Purchased should be kept, adding one to the count for each different item purchased.
(c) An Accumulated Quantity should be kept, accumulating the total quantity of all the items purchased. This could be accumulating 5 of one item, 3 of another item, totaling 8 items so far, etc.
(d) An Accumulated Subtotal should be kept, accumulating the sum of all the subtotals calculated for all the Item Subtotals so far.
(e) An Accumulated Sales Tax should be kept, accumulating the sum of all the sales tax calculated for all the items purchased so far.
(f) A Final Total Amount Due should be kept, accumulating the sum of all the Item Totals calculated for all the items purchased so far.
(g) The Accumulated Subtotal and Accumulated Sales Tax should add up to the Final Total Amount Due.
(h) Module level variables should be used to calculate these values.
(10) Calculation values and formatting values:
(a) All decimal valued calculations should be done using single precision or decimal valued variables that can accommodate four significant positions to the right of the decimal to store data content.
(b) All output values that are decimal valued should be displayed using a currency format with two decimal positions.
(c) All output values that are integer valued should be displayed using an integer format.
(d) These would include individual item subtotals, sales tax, item totals, accumulated item subtotals, accumulated sales tax totals, final total amounts due, etc.
(11) When the Clear button is pressed:
(a) All the values in the left side of the form should be cleared, displaying blank text
boxes, so that another item’s data can be entered.
(b) The values on the right side of the form should remain the same and stay visible.
(12) When the Print Form button is clicked, a screen print of the current contents of the form
should be printed.
(a) When the Exit button is clicked, the current loaded form should be exited.
- The Try Catch block programming functionality should be built into the logic to capture the possibility that a user may enter an invalid quantity or an invalid price or both for the individual item.
- The following form should be built in Visual Basic:
I am having trouble with mdecAccumulatedSubtotal = mdecAccumulatedSubtotal + decSubTotal().
Here is the rest of my code:
Option Strict Off
Option Explicit On
Public Class Form1
Rebecca Katz
CSC 208-58
Data submitted: 2/17/2016
VB Lab 3
This program will be introducing Visual Basic calculations as well as local variables and modular level variables
Declaring Variables
Dim mintCountItemsPurchased As Integer
Dim mintAccumQuantity As Integer
Dim mdecAccumulatedSubtotal As Decimal
Dim mdecAccumSalesTax As Decimal = 0.07
Dim mdecFinalAmountDue
Private Property mCdecountItemsPurchased As Integer
Private Sub btnCalcItemTotal_Click(sender As Object, e As EventArgs) Handles btnCalcItemTotal.Click
Try
Dim decSubTotal As Decimal
Dim intQuantity As Integer
Dim decItemPrice As Decimal
Dim dblSalesTax As Decimal
Dim dblItemTotal As Decimal
Const decSalesTax As Decimal = 0.07
Calculating values on left side of the form
decSubTotal = intQuantity * decItemPrice
lblQuantity.Text = intQuantity.ToString("s")
lblItemPrice.Text = decItemPrice.ToString("I")
dblSalesTax = 0.07 * decSubTotal
dblItemTotal = decSalesTax + decSubTotal
Catch
lblStatus.Text = "Invalid quantity or price"
End Try
End Sub
Private Sub btnAddItem_Click(sender As Object, e As EventArgs) Handles btnAddItem.Click
Calculating items ont the right side of the form
mintCountItemsPurchased = mintCountItemsPurchased + 1
mintAccumQuantity = mintAccumQuantity + 5 + 3
mdecAccumulatedSubtotal = mdecAccumulatedSubtotal + decSubTotal()
mdecAccumulatedSalesTax = mdecAccumulatedSalesTax + decSalesTax()
mFinalAmountDue = mdecFinalAmountDue
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
Clearing values from the left side of the form
intQuantity.Clear()
strItemName.Clear()
decItemPrice.Clear()
dblSubTotal.Clear()
dblSalesTax.Clear()
dblItemTotal.Clear()
End Sub
Private Function decSalesTax() As Object
Throw New NotImplementedException
End Function
Private Function mAccumSalesTax() As Object
Throw New NotImplementedException
End Function
Private Function decSubTotal() As Decimal
Throw New NotImplementedException
End Function
End Class
Continue reading...