By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,949 Members | 1,126 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,949 IT Pros & Developers. It's quick & easy.

Coding for a Smoothie Queen Calculator

P: 1
I am trying to write code in visual basic that combines check boxes and radio buttons and combo boxes so that it will include the quantity in order to calculate the subtotal to include the extras from the check boxes and discount from the radio buttons and the size and the style from the combo boxes. Then add the tax to get the amount due. I have not ever code something that combines all of this at one time and not sure how to do this because the size and style options are prices of the smoothies that are in a 2-dimensional array that can't be put in a loop. Help!!!

Here is part of what I have already started in the code:
Expand|Select|Wrap|Line Numbers
  1. 'Class-level declarations
  2.     Const decTAX_RATE As Decimal = 0.08D                  'Tax Rate
  3.     Const decECHINACEA As Decimal = 0.75D                 'Cost of Echinacea Extra
  4.     Const decBEE_POLLEN As Decimal = 0.75D                'Cost of Bee Pollen Extra
  5.     Const decENERGY_BOOSTER As Decimal = 0.75D            'Cost of Energy Booster Extra
  6.     Const decPREFERRED_DISCOUNT As Decimal = 0.15D        'Preferred Discount Rate
  7.     Const decCOUPON_DISCOUNT As Decimal = 0.1D            'Coupon Discount Rate
  8.     Const decREGULAR_SMALL As Decimal = 5.99D             'Cost of Regular Small Smoothie
  9.     Const decREGULAR_MEDIUM As Decimal = 6.99D            'Cost of Regular Medium Smoothie
  10.     Const decREGULAR_LARGE As Decimal = 7.99D             'Cost of Regular Large Smoothie
  11.     Const decREGULAR_KING As Decimal = 8.99D              'Cost of Regular King Smoothie
  12.     Const decORGANIC_SMALL As Decimal = 6.99D             'Cost of Organic Small Smoothie
  13.     Const decORGANIC_MEDIUM As Decimal = 7.99D            'Cost of Organic Medium Smoothie
  14.     Const decORGANIC_LARGE As Decimal = 8.99D             'Cost of Organic Large Smoothie
  15.     Const decORGANIC_KING As Decimal = 9.99D              'Cost of Organic King Smoothie
  16.     Const intMAX_ROW As Decimal = 1                       'Maximum number of rows
  17.     Const intMAX_COL As Deciaml = 3                       'Maximum number of columns
  19.     Private Sub btnCalculate_Click(sender As Object, e As EventArgs)
  20.         'Below we will begin to write for the calculations for the total of an order.
  21.         Dim decSubTotal As Decimal                        'Holds the order subtotal
  22.         Dim decTax As Decimal                             'Holds the sales tax
  23.         Dim decAmtDue As Decimal                          'Holds the order total
  24.         Dim decExtras As Decimal                          'Holds the extra amount
  25.         Dim decDisc As Decimal                            'Holds the discount amount
  26.         Dim intRow, intCol As Decimal                     'Holds the Smoothie amount
  29.         Dim smoothieListDecimal(,) As Decimal = {{5.99D, 6.99D, 7.99D, 8.99D}, _
  30.                                                 {6.99D, 7.99D, 8.99D, 9.99D}}
Dec 4 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.