VISUAL BASIC
Design and develop a simple application System that determine the most economical quantity to be stocked for each product that a manufacturing company has in its inventory this quantity called economics order quantity (EOQ) is calculated as following
EOQ = sqrt (2RS/I)
Where
R = total yearly Production Requirement
S = Set up Cost per order
I = inventory carrying cost per unit
Note: After the user enter the total year production Requirements (R) its set up cost per oder (S) and inventory carrying cost per unit (I) at text baxes 1,2 & 3 expectively the user should Click button (with a compute caption) before the resulting computed value will be displayed at the text box 4
Use the Convert.TextString(Math.Eqrt(intNum1)); mathematical function to get the square root value
where intNum1 is the number of square root
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.btnCalculate = New System.Windows.Forms.Button()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtEOQ = New System.Windows.Forms.TextBox()
Me.txtI = New System.Windows.Forms.TextBox()
Me.txtS = New System.Windows.Forms.TextBox()
Me.txtR = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
'
'btnCalculate
'
Me.btnCalculate.Location = New System.Drawing.Point(260, 133)
Me.btnCalculate.Name = "btnCalculate"
Me.btnCalculate.Size = New System.Drawing.Size(100, 23)
Me.btnCalculate.TabIndex = 11
Me.btnCalculate.Text = "Calculate"
Me.btnCalculate.UseVisualStyleBackColor = True
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(213, 99)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(33, 13)
Me.Label4.TabIndex = 8
Me.Label4.Text = "EOQ:"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(52, 73)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(194, 13)
Me.Label3.TabIndex = 9
Me.Label3.Text = "Enter inventory carrying cost per unit (I):"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(92, 47)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(154, 13)
Me.Label2.TabIndex = 10
Me.Label2.Text = "Enter Set up Cost per order (S):"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(27, 21)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(219, 13)
Me.Label1.TabIndex = 7
Me.Label1.Text = "Enter total yearly Production Requirement(R):"
'
'txtEOQ
'
Me.txtEOQ.Location = New System.Drawing.Point(260, 96)
Me.txtEOQ.Name = "txtEOQ"
Me.txtEOQ.ReadOnly = True
Me.txtEOQ.Size = New System.Drawing.Size(100, 20)
Me.txtEOQ.TabIndex = 4
'
'txtI
'
Me.txtI.Location = New System.Drawing.Point(260, 70)
Me.txtI.Name = "txtI"
Me.txtI.Size = New System.Drawing.Size(100, 20)
Me.txtI.TabIndex = 3
'
'txtS
'
Me.txtS.Location = New System.Drawing.Point(260, 44)
Me.txtS.Name = "txtS"
Me.txtS.Size = New System.Drawing.Size(100, 20)
Me.txtS.TabIndex = 6
'
'txtR
'
Me.txtR.Location = New System.Drawing.Point(260, 18)
Me.txtR.Name = "txtR"
Me.txtR.Size = New System.Drawing.Size(100, 20)
Me.txtR.TabIndex = 5
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(397, 175)
Me.Controls.Add(Me.btnCalculate)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtEOQ)
Me.Controls.Add(Me.txtI)
Me.Controls.Add(Me.txtS)
Me.Controls.Add(Me.txtR)
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "EOQ"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents btnCalculate As System.Windows.Forms.Button
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtEOQ As System.Windows.Forms.TextBox
Friend WithEvents txtI As System.Windows.Forms.TextBox
Friend WithEvents txtS As System.Windows.Forms.TextBox
Friend WithEvents txtR As System.Windows.Forms.TextBox
End Class
Public Class Form1
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim R As Double = Double.Parse(txtR.Text)
Dim S As Integer = Integer.Parse(txtS.Text)
Dim I As Double = Double.Parse(txtI.Text)
Dim EOQ As Double = Math.Sqrt(2 * R * S / I)
txtEOQ.Text = Convert.ToString(EOQ)
End Sub
End Class
Comments
Leave a comment