Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this exercise, you modify the Sales Express application coded in the chapter. Use Windows to make a copy of the Sales Express Solution folder.

In this exercise, you modify the Sales Express application coded in the chapter. Use Windows to make a copy of the Sales Express Solution folder. Save the copy in the ClearlyVB2012\Chap12 folder. Rename the copy Modified Sales Express Solution. Open the Sales Express Solution (Sales Express Solution.sln) file contained in the Modified Sales Express Solution folder. Open the Code Editor window. Change the Do clause to use the While keyword rather than the Until keyword. If the counter contains the number 0, display a message informing the user that no sales amounts were entered. Display the message in a message box. After displaying the average sales amount, change the lblAvg controls BorderStyle property to BorderStyle.None, blink the text in the control five times, and then change the BorderStyle property back to BorderStyle.FixedSingle. Save the solution and then start and test the application. Close the Code Editor window and then close the application.

Public Class FrmMain Private Sub BtnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub BtnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click ' calculates and displays the average sales amount Const strPROMPT As String = "Enter a sales amount. Click Cancel to end." Const strTITLE As String = "Sales Entry" Dim strInputSales As String Dim intNumSales As Integer 'counter Dim decTotalSales As Decimal 'accumulator Dim decSales As Decimal Dim decAvg As Decimal 'initialize counter and accumulator intNumSales = 0 decTotalSales = 0 'get the first sales amount strInputSales = InputBox(strPROMPT, strTITLE, "0.00") Do While strInputSales = String.Empty Decimal.TryParse(strInputSales, decSales) decTotalSales = decTotalSales + decSales intNumSales = intNumSales + 1 'get another sales amount strInputSales = InputBox(strPROMPT, strTITLE, "0.00") Loop If intNumSales <> 0 Then decAvg = decTotalSales / intNumSales End If lblAvg.Text = decAvg.ToString("C2") End Sub End Class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

Students also viewed these Databases questions

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago