success error

Form Is Invalid!

Get Best BIS311 Lab 3

Get Best BIS311 Lab 3

 

Lab 3 of 7: A Tax Calculator Class in Visual Basic
Submit your assignment to the Dropbox located on the silver tab at the top of this page.
(See Syllabus “Due Dates for Assignments & Exams” for due dates.)
L A B O V E R V I E W
Scenario and Summary
In this lab, you will implement a tax-calculator application. You’ll start by designing a tax-calculator class. Then, you will create the user interface of the driver program. Last, you will write the code for the button-click event that uses an object of your class. When your driver program is working, it will do a tax calculation that looks like this, with the tax owing formatted as currency.
Deliverables
Section
Deliverable
Points
Step 9
Lab3YourFirstLastName.docx (Word document)
40
Category
Points
%
Create and name a TaxCalculator class.
7
17.5%
Open a class and implement the public properties.
8
20%
Create a form, as shown, and set the properties.
5
12.5%
Code the button-click event.
10
25%
Test it using the sample data provided.
10
25%
Total
40
100%
L A B S T E P S
STEP 1: Open Visual Studio
Open up Visual Studio as usual and start up a new Windows Forms Application project.
Save the project as Lab3YourFirstnameYourLastname.
TIP: To do this, pull down the File menu in Visual Studio, select New, and then select Project. For Project Type, make sure Windows is selected under Visual Basic. For the template, make sure the Windows Forms Application is selected. Enter Lab3YourFirstnameYourLastname in the Name box, and click OK.
STEP 2: Go to Project–Add Class
Go to Project -> Add Class to bring up the following screen.
STEP 3: Name the Class
Name the class TaxCalculator.vb as listed in the screenshot above, and then click the Add button.
STEP 4: Open TaxCalculator.vb
In the Solution Explorer window, double-click on the tax calculator.vb class to display this window.
STEP 5: Implement the Public Properties
Implement the public properties and the calc tax( ) method. When finished, your class code should look like this.
Public Class TaxCalculator
Public income As Double Public Numchildren As Integer Public Function CalcTax() As Double Dim tax As Double tax = income * 0.25 – Numchildren * 150 Return tax End Function
End Class
STEP 6: Design the Driver Program
Now, design your driver program. Double-click the form (Form1.vb in the Solution Explorer), and design it so that it looks like the screenshot below. You should set the following properties along with any text properties not listed.
Control
Property
Setting
Textbox1
Name
txtIncome
Textbox2
Name
txtNumchildren
Button1
Name
btnDoTaxCalculation
Button1
Text
Display Tax Owing
Label3
Name
ll display
Label3 (now ll display)
Text
Your tax owing will display here
Form
Text
Lab3YourFirstLastname
TIP: To design the form, drag controls from the Toolbox and drop them where you want them on the form. You should see the Toolbox tab on the left side of the screen in Visual Studio. If it is collapsed against the left side, click it to expand it. Then, click the Pushpin icon (AutoHide) at the top right to lock it into place. For this form, you will need two textboxes, one button, and three labels, all of which are under the Common Controls heading in the Toolbox.
TIP: If you don’t see the Toolbox at all, it may have been closed inadvertently. Pull down the View menu, and click on Toolbox to bring it back.
STEP 7: Write the Button Code
Now, you can write the code for the button-click event. The code should follow the following pseudocode.
Start
Declare Variables CalcTax objCalcTax Numeric tax owing
Net Income, numchildren Taxowing=calcTax() Display tax owing
Stop
Double-click the button on the form to open its code window. Then, add code inside the button-click event to make it look like this.
Private Sub btnDoTaxCalculation_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles btnDoTaxCalculation.Click
Dim objCalcTax As New TaxCalculator Dim tax owing As Double
objCalcTax.income = txtIncome.Text objCalcTax.Numchildren = txtNumChildren.Text tax owing = objCalcTax.CalcTax()
ll, display.Text = “Tax owing is ” & Format(tax owing, “currency”)
End Sub
STEP 8: Test and Debug
Save your form and then test your program using a value of $1,000 for income and a value of 1 for the number of children. You should get a tax owing of $100. Debug any errors until the program runs properly.
STEP 9: Save the Word File
When you get your program working, take a screenshot of your form and place it in a Word file named Lab3YourFirstYourLastName.docx. Save the Word file and submit it to Lab 3 Dropbox.
Note on Debugging with Breakpoints
There is a useful feature for debugging your programs called breakpoints.
If you get the wrong answer for tax owing, you can set a breakpoint to the left of an instruction. Your program will stop, or break, right there and will allow you to put your mouse over the variables in your program, displaying the program at that point.
Here is a screenshot of a breakpoint set in the button-click event by clicking to the left of its final step.

Want Guide to Labs?

Are you looking for online test preparation assistance? You can avoid all the worries associated with taking online examinations by using our take my online exam expertise. As you prepare for your online exam, our exam helper will provide you with the most exact solution. We encourage you to ask our online exam helper for advice to determine the best course of action for passing your take-a-look. Many university students in well-known international locations like the United States, Canada, Australia, and the United Kingdom have benefited from our group’s online exam assistance, and they have all received respectable grades as a result. What then are you prepared for? Seize this chance to shine on your examination. Talk to us right now!

Placeholder $3.99
Get Best BIS311 Lab 3
  • 200+ Downloads
  • 8k Views