Write a VB App that entered the students' marks on the textbox and display the final decision on the label after clicking on the button Get the Decision. The evaluation of the results shall be as follow:
- If the student marks are less or equal to 40, the decision will be failed,
- If the student's marks are greater than 40 and less or equal to 45, the decision will be student must write the sup exams,
- If the student's marks are greater than 45 and less or equal to 60, the decision will be student passed,
- If the student's marks are greater than 60 and less or equal to 75, the decision will be student passed with satisfaction,
<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.btnGetDecision = New System.Windows.Forms.Button()
Me.txtStudentMarks = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.lblFinalDecision = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'btnGetDecision
'
Me.btnGetDecision.Location = New System.Drawing.Point(268, 103)
Me.btnGetDecision.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6)
Me.btnGetDecision.Name = "btnGetDecision"
Me.btnGetDecision.Size = New System.Drawing.Size(200, 42)
Me.btnGetDecision.TabIndex = 0
Me.btnGetDecision.Text = "Get the Decision"
Me.btnGetDecision.UseVisualStyleBackColor = True
'
'txtStudentMarks
'
Me.txtStudentMarks.Location = New System.Drawing.Point(268, 39)
Me.txtStudentMarks.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6)
Me.txtStudentMarks.Name = "txtStudentMarks"
Me.txtStudentMarks.Size = New System.Drawing.Size(196, 29)
Me.txtStudentMarks.TabIndex = 1
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(58, 44)
Me.Label1.Margin = New System.Windows.Forms.Padding(6, 0, 6, 0)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(191, 24)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Enter student mark:"
'
'lblFinalDecision
'
Me.lblFinalDecision.AutoSize = True
Me.lblFinalDecision.Location = New System.Drawing.Point(58, 185)
Me.lblFinalDecision.Margin = New System.Windows.Forms.Padding(6, 0, 6, 0)
Me.lblFinalDecision.Name = "lblFinalDecision"
Me.lblFinalDecision.Size = New System.Drawing.Size(141, 24)
Me.lblFinalDecision.TabIndex = 3
Me.lblFinalDecision.Text = "Final decision"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(12.0!, 24.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(580, 262)
Me.Controls.Add(Me.lblFinalDecision)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtStudentMarks)
Me.Controls.Add(Me.btnGetDecision)
Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Decision"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents btnGetDecision As System.Windows.Forms.Button
Friend WithEvents txtStudentMarks As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents lblFinalDecision As System.Windows.Forms.Label
End Class
Public Class Form1
Private Sub btnGetDecision_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetDecision.Click
Dim mark As Integer
Integer.TryParse(txtStudentMarks.Text, mark)
'- If the student marks are less or equal to 40, the decision will be failed,
If mark <= 40 Then
lblFinalDecision.Text = "The decision is: failed"
End If
'- If the student's marks are greater than 40 and less or equal to 45, the decision will be student must write the sup exams,
If mark > 40 And mark <= 45 Then
lblFinalDecision.Text = "The decision is: student must write the sup exams"
End If
'- If the student's marks are greater than 45 and less or equal to 60, the decision will be student passed,
If mark > 45 And mark <= 60 Then
lblFinalDecision.Text = "The decision is: student passed"
End If
'- If the student's marks are greater than 60 and less or equal to 75, the decision will be student passed with satisfaction,
If mark > 60 And mark <= 75 Then
lblFinalDecision.Text = "The decision is: student passed with satisfaction"
End If
End Sub
End Class
Comments
Leave a comment