Question
Visual Basic The local smoothie store, Smoothie Queen has hired you to develop a program that will make it easier for their sales associates to
Visual Basic
The local smoothie store, Smoothie Queen has hired you to develop a program that will make it easier for their sales associates to compute a customer's bill. You are to write a program that will allow the cashier to enter in customer information, smoothie information and display the total amount due. Here are the pertinent details:
CALCULATIONS:
COST OF A SMOOTHIE: The actual cost of the smoothie is based on the smoothie size and the smoothie style. See the table below for price information. Internally you can handle this in one of two ways you can either store this in a two-dimensional array/table or you can use an array of structures with two fields like you did in the state/abbreviation program.
| Small | Medium | Large | King |
Regular | 5.99 | 6.99 | 7.99 | 8.99 |
Organic | 6.99 | 7.99 | 8.99 | 9.99 |
There are two different ways to approach the needed programming for the smoothie prices. You can use either of these whichever one makes the most sense to you. My personal approach would be the first one (two dimensional arrays) because the data lays out like an Excel spreadsheet so its easy to think in rows and columns. But many people would also take the second approach (array of structures):
Two-Dimensional Array Approach: If you are going to use a 2 dimensional array/table, you could declare it using something like this at the top of your program near your constants:
Dim smoothieListDecimal (,) As Decimal = {{5.99D, 6.99D, 7.99D, 8.99D}, _
{6.99D, 7.99D, 8.99D, 9.99D}}
In this setup the cost for a particular smoothie would be based on a row and column of the table. For example, smoothieListDecimal(0, 3) would contain the price of a Regular King Smoothie. You will be able to use the selectedIndex for each of the dropdown lists to determine the row and column you need.
TIP: You do not need a loop to search for the correct smoothie price. You only need to know the selectedIndex values for the row (smoothie style) and column (smoothie size)
Array of Structures Approach: A different approach would be to use an array of structures. If you are going to use an array of structures, you could use a similar setup to the state/abbreviation program with the fields being regularDecimal and organicDecimal. You would then need an array of 4 structure elements (for each size) that you would initialize in the form load.
SMOOTHIE EXTRAS: A customer can order one or more extras for their smoothie. Toppings are $0.75 each (use a constant) and will be one of the following:
Echinacea
Bee Pollen
Energy Booster
DISCOUNTS: A customer may receive a discount on their purchase. Discounts are computed before taxes and can be one of the following (use a constant):
None no discount
Preferred customer card - 15% discount
Coupon - 10% discount
TAXES: The final bill should also add in a state sales tax of 8% before calculating the amount due. You should incorporate a METHOD / FUNCTION to compute the tax.
CONSTANTS: Use appropriate constants for all numerical values that are predefined (e.g., extras, tax, discounts).
FORMS SPECIFICATIONS AND VALIDATION
ABOUT FORM: Your program should have an About form that contains the typical information (program name, date, author, etc.). See sample EXE.
MAIN FORM (Customer Data): This form will need several components. There are also several required fields that should display appropriate error messages. When in doubt, refer to the sample EXE or post a question on the discussion board.
TEXT BOXES: You will use textboxes for the customer information. All fields must contain information or an error message will be displayed.
Customer Name
TIP: You do not need to use a Try/Catch to do all the data validation since these are not numeric text fields. You can use a nested IF/ELSE setup to test the fields for the required input to make sure they are not blank.
COMBO BOXES/DROPDOWN LISTS
Smoothie Size: Should be one of the following small, medium, large or king. Selection required. A size must be selected or an error should appear. Hint: Check to ensure the selectedIndex <> -1.
Smoothie Style: Should be one of the following regular or organic. Selection required. A style must be selected or an error should appear. Hint: Check to ensure the selectedIndex <> -1.
CHECKBOXES/GROUPS:
Extras: Can be none, or, one or more of the following: Echinacea, Bee Pollen and Energy Booster.
RADIO BUTTONS/GROUPS:
Discount: May be none or 10% coupon or preferred customer (15% discount).
PULL DOWN MENUS: The menu system should contain the following options (you can organize the menu choices however youd like):
Calculate - Totals the customer's bill after adding any extras, deducting discounts and adding appropriate tax (assuming all data validation tests are passed). Displays the subtotal, discount, tax and amount due in the label box as currency. Note that if any validation error occurs, the program should not calculate or display any totals.
Clear - Clears all the text, check and option buttons, and totals. Repositions the cursor in the customer name text box for the next customer.
Help/About Message box with your name and program name.
File/Exit - Exits the program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started