50 likes | 169 Views
This tutorial outlines how to create a simple Visual Basic application for calculating total sales and sales percentages for various baked goods during a bake sale event. By utilizing the double-click functionality of a button, users can input quantities of cookies, cakes, pies, and muffins, with the program calculating the total sales and individual percentages effortlessly. Follow the provided code snippets to ensure your formulas work correctly. Make sure to save your work and test the functionality to confirm it operates as expected. Enjoy your long weekend!
E N D
More Mathematical OperatorsBake Sale Program October 8, 2009
Open VB. Create the following form:
Double click the Calculate button and enter the following code: 'Calculate Total Sales lblTotalSales.Caption = Val(txtCookies.Text) _ + Val(txtCakes.Text) + Val(txtPies.Text) + _ Val(txtMuffins.Text)
'Calculate Sales Percentages lblCookiesPerc.Caption= Fix(Val(txtCookies.Text) / _ Val(lblTotalSales.Caption) * 100) lblCakesPerc.Caption = Fix(Val(txtCakes.Text) / _ Val(lblTotalSales.Caption) * 100) lblPiesPerc.Caption = Fix(Val(txtPies.Text) / _ Val(lblTotalSales.Caption) * 100) lblMuffinsPerc.Caption = Fix(Val(txtMuffins.Text) / _ Val(lblTotalSales.Caption) * 100)
Save your work! • Run your program.....does it work? • I’ll walk around to check and give you credit. Have a great weekend! 3 day weekend.........