Title | Bagel Shop solution |
---|---|
Author | Ashton Sandoval |
Course | Intro Computers & Program |
Institution | University of Alabama in Huntsville |
Pages | 1 |
File Size | 72.2 KB |
File Type | |
Total Downloads | 97 |
Total Views | 158 |
assignment submission solution...
Bagel Shop
Public Class frmbagel 'A neighborhood bakery sells bagels at $0.75 each. 'But if the customer buys 6 or more the price each is $0.60. 'Write a program that prompts the user for the number of bagels purchased and then prints the total cost. 'Test the program for the following orders: 1 bagel, 5 bagels, 6 bagels, 12 bagels. Private Sub btnQuit_Click(sender As Object, e As EventArgs) Handles btnQuit.Click End End Sub Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btnclear.Click txtnumber.Clear() lstTotal.Items.Clear() End Sub Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click Dim bagels As Integer Dim cost As Double Dim discount As Double Dim total As Double Integer.TryParse(txtnumber.Text, bagels) cost = 0.75 discount = 0.6 If bagels >= 6 Then 'If customer orders 6 or more bagels the total cost is 0.60 cents per bagel total = bagels * discount ElseIf bagels < 6 Then 'If customer orders less than 6 bagels the total cost is 0.75 cents per bagel total = bagels * cost End If lstTotal.Items.Add(FormatCurrency(total)) End Sub End Class...