0% found this document useful (0 votes)
6 views2 pages

Sales Tracking Program in VB.NET

The document describes a Visual Basic program that tracks sales data for multiple salespeople. It initializes variables, inputs sales amounts for each salesperson, calculates totals for individual salespeople using either IF statements or a CASE statement, calculates a grand total and overall average, and outputs the results. Key data structures include arrays to store the running totals for each salesperson and variables to track the overall totals and averages.

Uploaded by

dabr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Sales Tracking Program in VB.NET

The document describes a Visual Basic program that tracks sales data for multiple salespeople. It initializes variables, inputs sales amounts for each salesperson, calculates totals for individual salespeople using either IF statements or a CASE statement, calculates a grand total and overall average, and outputs the results. Key data structures include arrays to store the running totals for each salesperson and variables to track the overall totals and averages.

Uploaded by

dabr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Module Program

Dim SalesPersonID, salescounter As Integer


Dim SalesAmt, GrandTotalSales, OverallAvgSales As Double
Dim SalesPersonTotal(3) As Double
Dim caseorif As Integer

Sub Main()
Call Initialise()
Do
Call Inputdata()
Call Processdata()
Loop Until SalesPersonID = -1
Call GrandTotal()
Call Overallaverage()
Call Outputdata()
[Link]()
End Sub
Sub Initialise()
For I = 1 To 3
SalesPersonTotal(I) = 0
Next
GrandTotalSales = 0
salescounter = 0
End Sub
Sub Processdata()
[Link]("Choose to use CASE or IF selecion. Enter 1 to use CASE, 2 to use
IF")
caseorif = [Link]

If caseorif = 2 Then
Call CASEtotalling()
ElseIf caseorif = 1 Then
Call IFtotalling()
End If

salescounter += 1
End Sub
Sub Inputdata()
Do
[Link](“Enter Salesperson’s ID: 1, 2 or 3. Enter -1 to exit”)
SalesPersonID = [Link]
Loop Until SalesPersonID = 1 Or SalesPersonID = 2 Or SalesPersonID = 3 Or
SalesPersonID = -1
If SalesPersonID <> -1 Then
[Link](“Enter sales amount”)
SalesAmt = [Link]
End If
End Sub
Sub IFtotalling()
If SalesPersonID = 1 Then
SalesPersonTotal(1) += SalesAmt
ElseIf SalesPersonID = 2 Then
SalesPersonTotal(2) += SalesAmt
ElseIf SalesPersonID = 3 Then
SalesPersonTotal(3) += SalesAmt
ElseIf SalesPersonID = -1 Then
Else
[Link]("Error: plz enter 1,2 or 3")
End If
End Sub
Sub CASEtotalling()
Select Case SalesPersonID
Case 1
SalesPersonTotal(1) += SalesAmt
Case 2
SalesPersonTotal(2) += SalesAmt
Case 3
SalesPersonTotal(3) += SalesAmt
Case -1
Case Else
[Link]("Error: plz enter 1,2 or 3")
End Select
End Sub
Sub GrandTotal()
For z = 1 To 3
GrandTotalSales += SalesPersonTotal(z)
Next
End Sub
Sub Overallaverage()
salescounter -= 1
OverallAvgSales = GrandTotalSales / salescounter
End Sub
Sub Outputdata()
[Link]("Average of all sales: " & OverallAvgSales)
[Link]("Total overall sales: " & GrandTotalSales)
For x = 1 To 3
[Link]("Total for sales person " & x & ": " & SalesPersonTotal(x))
Next
End Sub
End Module

You might also like