Question
Programming Problem 2: Bulk Buyers Club In your Microsoft Visual Studios Program, using C# The discounts on paper towels at Bulk Buyers Intl are as
Programming Problem 2: Bulk Buyers Club
In your Microsoft Visual Studios Program, using C#
The discounts on paper towels at Bulk Buyers Intl are as follows:
Quantity | Discount |
< 10 | 0% |
10 20 | 5% |
21 30 | 10% |
31+ | 20% |
Senior Citizens get an additional 15% discount regardless of quantity ordered. Double rolls count as two rolls for quantity discount purposes. A single roll is 89 cents and a double roll is $1.20. Calculate and subtract the discount quantity discount before calculating the student discount. Round to nearest cent.
Your deliverables:
Provide the discount percentages and discount amounts and total due for these purchases:
| Test Cases | ||||
| 1 | 2 | 3 | 4 | 5 |
Single Rolls | 10 | 25 | 4 | 5 | 26 |
Double Rolls | 10 | 3 | 4 | 1 | 2 |
Senior? | yes | yes | no | yes | no |
Subtotal | $ 20.90 | 25.85 | 8.36 | 5.65 | 25.54 |
Quantity Discount % | 10% | 20% | 5% | 0% | 10% |
Quantity Discount Amount in $ | $2.09 | 5.17 | .42 | none | 2.55 |
Subtotal | $ 18.81 | 20.68 | 7.94 | 5.65 | 22.99 |
Senior Discount % | 15% | 15% | none | 15% | none |
Quantity Discount Amount in $ | $2.82 | 3.10 | none | .85 | none |
Total | $ 15.99 | 17.58 | 7.94 | 4.8 | 22.99 |
Create an application that calculates the data shown in the table above. The GUI:
- Three buttons, Calculate, Clear and Exit. Assign a keyboard access key to each of the buttons. (page 177).
-Two TextBoxes for user input; one for the number of single rolls the other for double rolls (include a label for each textbox)
-A radio button to indicate whether a student.
-Six labels for the results of calculations include explanatory labels for each (12 labels in total), some labels will only show if the discount is applied.
-The Accept Button should be the calculate button, the Cancel Button should be the clear button.
-The program should calculate and display to the GUI the following data as Labels:
Subtotal (formatted as currency)
The discount percentage (format as percent),
The student discount % only if the discount is greater than 0
Discount amount (formatted as currency)
The student discount amount only if it is greater than 0
Total amount due (formatted as currency).
Requirements in your code
Program only accepts whole numbers only for the number of rolls
If Statements:
Use an if statement and a Try.Parse() to validate EACH user input, add else statements with MessageBox for invalid user entry
if (int.TryParse(sRollsTextBox.Text, out sRolls)) //my textbox was called singleRollsTextBox
{
if (int.TryParse(dRollsTextBox.Text, out dRolls))
{
//calculate total number of rolls
//use if -else if else to check for quantity discount
//check for senior discount use if statement see note 2 below.
// output results
}
else //error messagebox here
}
else //error messagebox here
Use a single if statement for the student discount
if (discountButton.Checked)
{
discount = 0.10;
}
Remember always use Decimal when working with currency.
Format all other numbers when output to GUI
You must delete any unused event handlers see video for instructions
Remember to fully comment your code
Follow all rules of good programming, including naming conventions and indenting
Always check the generic grading rubric.
Paste all your code for Form1 here:
Paste a screenshot of your Properties window of your Form1 to show that the acceptButton and cancelButton have been set properly.
Place a breakpoint in your program at the start of your if statement for quantity, using the first test case from above, take a screenshot when the breakpoint is reached, then step through your program until the correct if else -if activates take a screenshot of your code at this point. Make sure your Locals window is clearly visible in both screenshots. Note: Please change your screen colors for these screenshots if using a dark background otherwise it is impossible for me to see it.
Place a second breakpoint in your program at the start of your if statement for your first Try.Parse. Use 44b as the number of single roles. Take a screenshot of your code when the else portion of this statement is reached. Make sure your Locals window is clearly visible.
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