Question

In: Computer Science

Visual Basics 2015 The local smoothie store, Smoothie Queen has hired you to develop a program...

Visual Basics 2015 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: 1. 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 it’s easy to think in rows and columns. But many people would also take the second approach (array of structures): A. 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: decimal[,] smoothieListDecimal = {{ 5.99M, 6.99M, 7.99M, 8.99M }, { 6.99M, 7.99M, 8.99M, 9.99M }}; 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) B. 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. 2. 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 3. 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 4. 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. 5. CONSTANTS: Use appropriate constants for all numerical values that are predefined (e.g., extras, tax, discounts). FORMS SPECIFICATIONS AND VALIDATION 1. ABOUT FORM: Your program should have an “About” form that contains the typical information (program name, date, author, etc.). See sample EXE. 2. 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. 3. 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. 4. 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. 5. CHECKBOXES/GROUPS: • Extras: Can be none, or, one or more of the following: Echinacea, Bee Pollen and Energy Booster. 6. RADIO BUTTONS/GROUPS: • Discount: May be none or 10% coupon or preferred customer (15% discount). 7. PULL DOWN MENUS (EXTRA CREDIT): The menu system should contain the following options (you can organize the menu choices however you’d 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. I have seen this posted before but wanted to see if someone would be able to explain more and possibly post screenshots of the code. Thank you in advance!

Solutions

Expert Solution

The Required code is given .

Images

CODE TO COPY

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim smoothieListDecimal(,) As Decimal = {{5.99D, 6.99D, 7.99D, 8.99D}, {6.99D, 7.99D, 8.99D, 9.99D}}

TextBox2.Text = Today()
TextBox1.Focus()
ComboBox1.Items.Add("Small")
ComboBox1.Items.Add("Medium")
ComboBox1.Items.Add("Large")
ComboBox1.Items.Add("King")

ComboBox2.Items.Add("Regular")
ComboBox2.Items.Add("Organic")

ComboBox3.Items.Add("Calculate")
ComboBox3.Items.Add("Clear")
ComboBox3.Items.Add("Help/About")
ComboBox3.Items.Add("File/Exit")

End Sub
Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
Dim name, size, style As String
Dim extras As Double = 0, discount As Double = 0, subtot As Double, amtdue As Double
Dim smoothieListDecimal(,) As Decimal = {{5.99D, 6.99D, 7.99D, 8.99D}, {6.99D, 7.99D, 8.99D, 9.99D}}

name = TextBox1.Text
If name = "" Then
TextBox1.Focus()
End If

size = ComboBox1.Text
If size = "" Then
ComboBox1.Focus()
End If

style = ComboBox2.Text
If style = "" Then
ComboBox2.Focus()
End If

If CheckBox2.Checked() = True Then
extras = extras + 0.75
End If
If CheckBox3.Checked() = True Then
extras = extras + 0.75
End If
If CheckBox4.Checked() = True Then
extras = extras + 0.75
End If

If RadioButton1.Checked() Then
discount = 0%
Else
If RadioButton2.Checked() Then
discount = 10%
Else
If RadioButton3.Checked() Then
discount = 15%
End If
End If
End If

If ComboBox3.Text = "Calculate" And name <> "" Then

Select Case size
Case "Small"
If style = "Regular" Then
subtot = smoothieListDecimal(0, 0)
Else
If style = "Organic" Then
subtot = smoothieListDecimal(1, 0)
End If
End If

Case "Medium"
If style = "Regular" Then
subtot = smoothieListDecimal(0, 1)
Else
If style = "Organic" Then
subtot = smoothieListDecimal(1, 1)
End If
End If

Case "Large"
If style = "Regular" Then
subtot = smoothieListDecimal(0, 2)
Else
If style = "Organic" Then
subtot = smoothieListDecimal(1, 2)
End If
End If

Case "King"
If style = "Regular" Then
subtot = smoothieListDecimal(0, 3)
Else
If style = "Organic" Then
subtot = smoothieListDecimal(1, 3)
End If
End If

End Select
subtot = subtot + extras
Label6.Text = Format(subtot, "$#,##0.00")
Label11.Text = discount & "%"
subtot = discount * subtot
Label12.Text = Format(subtot * 0.08, "$#,##0.00")
tax(subtot, amtdue)
Label13.Text = Format(amtdue, "$#,##0.00")
End If

If ComboBox3.Text = "Clear" Then
TextBox1.Focus()
TextBox1.Text = ""
End If

If ComboBox3.Text = "Help/About" Then
MsgBox("Smoothie Queen Author: ...................")
End If

If ComboBox3.Text = "File/Exit" Then
End
End If
End Sub
Function tax(ByVal subtot, ByRef amtdue) As Double
amtdue = subtot + subtot * 0.08
End Function
End Class

Output

Please Upvote.


Related Solutions

Write a program in Visual Basics that does the following: Read in 20 numbers, each of...
Write a program in Visual Basics that does the following: Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, print it only if it is not a duplicate of a number already read. Provide for the “worst case” in which all 20 numbers are different. Use the smallest possible array to solve this problem.
Im working with visual basics for these problem. 1) Write a program that accepts five integers,...
Im working with visual basics for these problem. 1) Write a program that accepts five integers, and for each integer following the first, prints "GREATER" or "LESS" depending on whether or not the current integer is greater than the previous one. At the end, your application will let user know the largest and the smallest of the five numbers provided (BONUS): consider using the concepts of swapping the current and previous values as needed and don't use 5 variables.
DEVELOP IN VISUAL STUDIOS C++ PLEASE 1. Develop a main program that does the following a)...
DEVELOP IN VISUAL STUDIOS C++ PLEASE 1. Develop a main program that does the following a) Create six nodes of integers such as n0, n1, n2, n3, n4, n5 (n0 is the head) b) Assign data to each nodes such as n1->data = 2; n2->data = 5, n3->data = 3, n4->data = 10, n5->data = 1. c) Make n0 ->next to point to n1, and n0->prev to point to NULL 2.) Print out the content of list you have created...
Develop a python program that will determine if a department store customer has exceeded the credit...
Develop a python program that will determine if a department store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available:  Account number  Balance at the beginning of the month  Total of all items charged by this customer this month  Total of all credits applied to this customer’s account this month  Allowed credit limit The program should input each of the facts, calculate the new balance (=beginning...
Develop a python program that will determine if a department store customer has exceeded the credit...
Develop a python program that will determine if a department store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available:  Account number, Balance at the beginning of the month, Total of all items charged by this customer this month, Total of all credits applied to this customer’s account this month and Allowed credit limit. The program should input each of the facts, calculate the new balance (=beginning balance + charges – credits),...
write a c++ program using micro soft visual studio 2010 to write a program and store...
write a c++ program using micro soft visual studio 2010 to write a program and store 36 in variable x and 8 in variable y. add them and store the result in the variable sum. then display the sum on screen with descriptive text. calculate the square root of integer 36 in x. store the result in a variable. calculate the cube root of integer 8 in y. store result in a variable. display the results of square root and...
You have just been hired as a community health program planner by a local city. The...
You have just been hired as a community health program planner by a local city. The city has noticed that childhood obesity rates have been steadily increasing and would like you to develop programs to help decrease childhood obesity in the city. You notice that the city does not have physical activity programs. Which model/framework would you use to develop such a program? Explain your answer.
Visual Basics In this exercise, you modify the History Grade application from this chapter’s Focus lesson....
Visual Basics In this exercise, you modify the History Grade application from this chapter’s Focus lesson. Use Windows to make a copy of the History Solution folder. Rename the copy History Solution-Functions. Open the History Solution.sln file contained in the History Solution-Functions folder. Modify the btnDisplay_Click procedure so that it uses two functions named GetGrade101 and GetGrade201 to get the appropriate grade; the procedure should then display the grade in the lblGrade control. Change the two independent Sub procedures to...
Google has hired you to develop an algorithm to detect spam emails. You have the following...
Google has hired you to develop an algorithm to detect spam emails. You have the following information for a user: a) Of all the emails she has previously sent to ‘spam’, 85% include the term “Check this out…”; b) Of all her ‘non-spam’ emails 10% include the term “Check this out…”; c) She sends 15% of all emails she receives to spam. What would be your rational guess about the probability that an email containing “Check this out...” is spam?...
You are the newly hired manager at The Great Nile Retail Store. The corporation has hundreds...
You are the newly hired manager at The Great Nile Retail Store. The corporation has hundreds of brick & mortar locations across the United States, with thousands of employees. Your specific location employs dozens of employees. You sell pretty much everything, organized neatly into multiple departments, with eye-catching merchandise displays that contain the trendiest retail products. Upon starting at your location, you learn that you have a good group of people working for you, but there have been consistent problems...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT