write vb 6 program that takes n numbers as input.it print the maximum number and its frequency (number occurrences). two sample runs of the proogram
1
Expert's answer
2012-04-28T10:13:25-0400
VERSION 5.00 Begin VB.Form Form1 Caption = quot;Form1" ClientHeight = 3465 ClientLeft = 60 ClientTop = 450 ClientWidth & = 7395 LinkTopic = quot;Form1" ScaleHeight & = 3465 ScaleWidth = 7395 StartUpPosition = 3& 'Windows Default Begin VB.CommandButton Command1 Caption = quot;Clear" Height = 975 Left = 2640 TabIndex & = 6 Top = 2400 Width & = 2535 End Begin VB.CommandButton Button_calculate Caption = quot;Enter" Height = 975 Left = 120 TabIndex & = 1 Top = 2400 Width & = 2415 End Begin VB.TextBox num_input BeginProperty Font Name = quot;MS Sans Serif" Size = 18 Charset = 204 Weight = 400 Underline = 0 #039;False Italic = 0 #039;False Strikethrough = 0 #039;False EndProperty Height = 1455 Left = 0 TabIndex & = 0 Top = 840 Width & = 5295 End Begin VB.Label Label6 Alignment = 2& 'Center Caption = quot;0" Height = 375 Left = 5400 TabIndex & = 9 Top = 3000 Width & = 2055 End Begin VB.Label Label5 Alignment = 2& 'Center Caption = quot;Frequency" Height = 255 Left = 5400 TabIndex & = 8 Top = 2640 Width & = 1935 End Begin VB.Label Label4 Alignment = 2& 'Center Caption = quot;0" Height = 255 Left = 5400 TabIndex & = 7 Top = 2280 Width & = 2055 End Begin VB.Label Label3 Alignment = 2& 'Center Caption = quot;Maximum number" Height = 375 Left = 5280 TabIndex & = 5 Top = 1800 Width & = 2175 End Begin VB.Label Label2 Alignment = 2& 'Center Caption = quot;0" Height = 375 Left = 5280 TabIndex & = 4 Top = 1440 Width & = 2175 End Begin VB.Label Label1 Alignment = 2& 'Center Caption = quot;Numbers entered" Height = 375 Index & = 0 Left = 5280 TabIndex & = 3 Top = 960 Width & = 2175 End Begin VB.Label Label1 Caption = quot;Please enter your number" BeginProperty Font Name = quot;MS Sans Serif" Size = 12 Charset = 204 Weight = 700 Underline = 0 #039;False Italic = 0 #039;False Strikethrough = 0 #039;False EndProperty Height = 735 Index & = 1 Left = 120 TabIndex & = 2 Top = 120 Width & = 6375 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim max_freq As Integer 'Frequency of max numbers Dim current_max_num As Single 'current maximum number Dim iteration_check As Integer 'counts the iterations
Private Sub Button_calculate_Click() 'Here we go on button click If IsNumeric(num_input.Text) And iteration_check = 0 Then current_max_num = num_input.Text iteration_check = 1 max_freq = 1 num_input.Text = "" Label2.Caption = iteration_check Label4.Caption = current_max_num Label6.Caption = max_freq Exit Sub End If
If IsNumeric(num_input.Text) Then
If num_input.Text > current_max_num Then current_max_num = num_input.Text max_freq = 1 ElseIf num_input.Text = current_max_num Then max_freq = max_freq + 1 End If
Else MsgBox ("Not numeric value") End If
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment