Question
vb.net Form 1: Spring Festival Snackbar Calculator: The purpose of this project is to calculate the total price that a customer needs to pay for
vb.net
Form 1: Spring Festival Snackbar Calculator:
The purpose of this project is to calculate the total price that a customer needs to pay for the snacks that they want to purchase at this years Spring Festival.
Four items are offered for sale at this snack bar:
Hamburgers - $3.00 each Fries - $1.00 each Candy - $1.00 each Drinks - $.50 each
For each customer order, a unique order Id will be generated.
This Id will be comprised of the first initial of the first name followed by the first initial of the last name and then a sequential number starting at 1000 and increasing by 1 for each order placed; for example if the first customer is Daniel Young, his order Id will be DY1000.
FYI: We wont store the order number in a file at this time, so each time you run the program, the order Id will start over at 1000.
Write and test the following two functions:
Data Validation The following checks should be made as part of your data validation:
o Make sure that text has been entered into the name textbox and that this name contains a space.
o Make sure that a value has been entered into at least ONE of the food item textboxes.
(To place an order, the user enters the number of each item that they wish to buy.)
Make sure that any values entered into a food item textbox is a numeric value.
Once the Data Validation function has been written, test your code.
Check each situation that you test for to make sure the appropriate message is displayed.
FYI: I used 7 conditions to check all requirements in my code. Dont forget to Return True if all of the input is found to be valid.
To test to see if the program would continue to execute when my input data was valid (the DataOk function returned a True), I displayed a message box that simply let me know that the data was ok (see code sample below): Private Sub btnOrderTotal_Click() Handles btnOrderTotal.Click If DataOk() = False Then Return End If MessageBox.Show("Data Ok") End Sub Order ID This function should generate and return the Order Id which will be created using the class-level order number variable (doesnt have to be passed) along with the event procedures local name variable (does have to be passed).
This variable will be comprised of the first initial of the first name followed by the first initial of the last name and then a sequential number starting at 1000 and increasing by 1 for each order placed; for example If the first customer is Daniel Young, his order Id will be DY1000. FYI: We wont store the order number in a file at this time, so each time you run the program, the order Id will start over at 1000.
To see if this function executes correctly, I once again used a message box. I also need to give a test value to the name variable within the code since the GetInput sub has not yet been written. Below is the code that I added after my data validation to test this function. ' Create a test value for the name variable Dim name, order As String name = "Daniel Thompson" order = OrderId(name) MessageBox.Show(order)
Be sure to run this event more than one time to make sure that the order number portion of the order Id does indeed increase with each execution. While this is an incomplete program, once you have these 2 functions coded and tested that is what is being requested.
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