BIS311 Lab 3 – source code with screenshot – Instant Delivery – Complete and A+ Guaranteed
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.
Lab3YourFirstLastName.docx (Word document)
Create and name a TaxCalculator class.
Open a class and implement the public properties.
Create a form, as shown, and set the properties.
Code the button-click event.
Test it using the sample data provided.
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 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 screen shot above, and then click the Add button.
STEP 4: Open TaxCalculator.vb
In the Solution Explorer window, double click on the TaxCalculator.vb class to display this window.
STEP 5: Implement the Public Properties
Implement the public properties and the calcTax( ) 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
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.
Display Tax Owing
Label3 (now lblDisplay)
Your tax owing will display here
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.
Declare Variables CalcTax objCalcTax Numeric taxowing
Get Income, numchildren Taxowing=calcTax() Display taxowing
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 taxowing As Double
objCalcTax.income = txtIncome.Text objCalcTax.Numchildren = txtNumChildren.Text taxowing = objCalcTax.CalcTax()
lblDisplay.Text = “Tax owing is ” & Format(taxowing, “currency”)
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 screen shot of your form and place it in a Word file named Lab3YourFirstYourLastName.docx. Save the Word file and submit it to the 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 screen shot of a breakpoint set in the button-click event by clicking to the left of its final step.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at email@example.com.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at firstname.lastname@example.org and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at email@example.com.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.