Prino33's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
6 (0.01 per day)
Joined:
15-November 12
Profile Views:
155
Last Active:
User is offline Dec 08 2012 01:54 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Prino33 has not set their status

Posts I've Made

  1. In Topic: Problem creating Minimum and Maximum Function

    Posted 7 Dec 2012

    Both sound great. I'm just having trouble figuring out how to implment either method into my code. Could either of you provide an example about how one could be done?

    Thanks!


    P.S. I addded the code I'm try to refactor below. Our teacher prdovided us with an example we just have to rewrite to work with our problem. Anyways, I dont know if you can decipher the code but im trying to refactor the code to work with a 4 value min/max equation.

    Option Strict On
    Option Explicit On
    Imports System.Convert
    Imports Microsoft.VisualBasic.ControlChars
    
    Public Class frmStats
    
        Private StatsData() As frmMain.sQuarterlySales = frmMain.SalesmansQuarterlySales
    
    
        Private Sub btnShowAverage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowAverage.Click
            Dim pdecAverageSale As Decimal
            Dim pdecTotalSales As Decimal
    
            For pintCount As Integer = 0 To StatsData.GetUpperBound(0)
                pdecTotalSales += StatsData(pintCount).Quarter1Sales + StatsData(pintCount).Quarter2Sales + StatsData(pintCount).Quarter3Sales + StatsData(pintCount).Quarter4Sales
            Next
    
            pdecAverageSale = pdecTotalSales / 4
    
            lblDisplayReport.Text = "The average sales amount is: " & pdecAverageSale.ToString("c")
        End Sub
    
    
    
        Private Sub btnShowMinimumPurchase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowMinimumPurchase.Click
            Dim pdecMinPurchase As Decimal
            Dim pdecPurchase As Decimal
            Dim pintCount As Integer
            Dim pintFound As Integer = 0
    
            pdecMinPurchase = StatsData(0).prodAmount * StatsData(0).prodPrice
    
            For pintCount = 1 To StatsData.GetUpperBound(0)
                pdecPurchase = StatsData(pintCount).prodAmount * StatsData(pintCount).prodPrice
                If pdecPurchase < pdecMinPurchase Then
                    pdecMinPurchase = pdecPurchase
                    pintFound = pintCount
                End If
            Next
    
            lblDisplayReport.Text = "The minimum purchase amount is: " & pdecMinPurchase.ToString("c") & " at location " & pintFound.ToString
        End Sub
    
        Private Sub btnShowMaxPurchase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowMaxPurchase.Click
            Dim pdecMaxPurchase As Decimal
            Dim pdecPurchase As Decimal
            Dim pintCount As Integer
            Dim pintFound As Integer = 0
    
            pdecMaxPurchase = 0
    
            For pintCount = 1 To StatsData.GetUpperBound(0)
                pdecPurchase = StatsData(pintCount).prodAmount * StatsData(pintCount).prodPrice
                If pdecPurchase > pdecMaxPurchase Then
                    pdecMaxPurchase = pdecPurchase
                    pintFound = pintCount
                End If
            Next
    
            lblDisplayReport.Text = "The minimum purchase amount is: " & pdecMaxPurchase.ToString("c") & " at location " & pintFound.ToString
        End Sub
    End Class
    
  2. In Topic: Function / Sub Procedure Question

    Posted 16 Nov 2012

    Posted wrong code. Uploaded current code.
  3. In Topic: Function Related Question.

    Posted 15 Nov 2012

    Thanks for the reply. You definitely got me on the right track. I think I'm going to try a select case function for the late charge fee. Not exactly sure how to do a sub procedure to display the results but I haven't really messed with it.

    Anyways thanks for the help!

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Prino33 hasn't added any friends yet.

Comments

Prino33 has no profile comments yet. Why not say hello?