P5: Design and Implement Two Different Working Event Driven Applications To Meet Defined Requirements

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

P5: Design and implement two different working event driven

applications to meet defined requirements.

This is the first part which


shows how to create the
program. This program is
about calculating the UCAS
point for university.

Each of these program


contain different job.

Once you click on pass the ruler will move one step to the right, so merit and destination are
work the same just click it and it will work.

After you choose


your grade then click
on calculate UCAS
and it will calculate
it and it will show
either it pass, merit
or distinction
Properties for UCAS point

Its coding for UCAS calculater.

Public Class Form1


Dim PassUnitPoints As Integer
Dim MeritUnitPoints As Integer
Dim DestinctionUnitPoints As Integer
Dim GradeBoundaryPoints As Integer
Dim UCASPass As Integer
Dim UCASMerit As Integer
Dim UCASDestinction As Integer
Dim UnitCounter As Integer
Friend PMin As Integer
Friend PMax As Integer
Friend PPMin As Integer
Friend PPMax As Integer
Friend PPPMin As Integer
Friend PPPMax As Integer
Friend MPMin As Integer
Friend MPMax As Integer
Friend MPPMin As Integer
Friend MPPMax As Integer
Friend MMPMin As Integer
Friend MMPMax As Integer
Friend MMin As Integer
Friend MMax As Integer
Friend MMMin As Integer
Friend MMMax As Integer
Friend MMMMin As Integer
Friend MMMMax As Integer
Friend DMin As Integer
Friend DMax As Integer
Friend DMMin As Integer
Friend DMMax As Integer
Friend DMMMin As Integer
Friend DMMMax As Integer
Friend DDMMin As Integer
Friend DDMMax As Integer
Friend DDMin As Integer
Friend DDMax As Integer
Friend DDDMin As Integer
Friend DDDMax As Integer
Friend Condition As Integer

Private Sub CmdPass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles CmdPass.Click
PassUnitPoints = 6
GradeBoundaryPoints = GradeBoundaryPoints + PassUnitPoints
UCASPass = UCASPass + 1
UnitCounter = UnitCounter + 1
TrBStatus.Value = TrBStatus.Value + 1
If TrBStatus.Value = TrBStatus.Maximum Then
CmdPass.Enabled = False
CmdMerit.Enabled = False
CmdDestinction.Enabled = False
End If
LblPass.Text = UCASPass & " Passes"
LblBoundaryPoints.Text = GradeBoundaryPoints & " Grade Boundary Points"
End Sub

Private Sub CmdMerit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles CmdMerit.Click
MeritUnitPoints = 12
GradeBoundaryPoints = GradeBoundaryPoints + MeritUnitPoints
UCASMerit = UCASMerit + 1
UnitCounter = UnitCounter + 1
TrBStatus.Value = TrBStatus.Value + 1
If TrBStatus.Value = TrBStatus.Maximum Then
CmdPass.Enabled = False
CmdMerit.Enabled = False
CmdDestinction.Enabled = False
End If
LblMerit.Text = UCASMerit & " Merits"
LblBoundaryPoints.Text = GradeBoundaryPoints & " Grade Boundary Points"
End Sub

Private Sub CmdDistinction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles CmdDestinction.Click
DestinctionUnitPoints = 18
GradeBoundaryPoints = GradeBoundaryPoints + DestinctionUnitPoints
UCASDestinction = UCASDestinction + 1
UnitCounter = UnitCounter + 1
TrBStatus.Value = TrBStatus.Value + 1
If TrBStatus.Value = TrBStatus.Maximum Then
CmdPass.Enabled = False
CmdMerit.Enabled = False
CmdDestinction.Enabled = False
End If
LblDistinction.Text = UCASDestinction & " Destinctions"
LblBoundaryPoints.Text = GradeBoundaryPoints & " Grade Boundary Points"
End Sub

Private Sub CmdCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles CmdCalculate.Click
If Condition = "1" Then
If GradeBoundaryPoints >= PMin And GradeBoundaryPoints <= PMax Then
LblGrade.Text = "Overall Grade: P"
LblPoints.Text = "40 UCAS Points"
ElseIf GradeBoundaryPoints >= MMin And GradeBoundaryPoints <= MMax Then
LblGrade.Text = "Overall Grade: M"
LblPoints.Text = "80 UCAS Points"
ElseIf GradeBoundaryPoints >= DMin And GradeBoundaryPoints <= DMax Then
LblGrade.Text = "Overall Grade: D"
LblPoints.Text = "120 UCAS Points"
Else
LblGrade.Text = "Overall Grade: Fail"
End If
End If
If Condition = "2" Then
If GradeBoundaryPoints >= PPMin And GradeBoundaryPoints <= PPMax Then
LblGrade.Text = "Overall Grade: PP"
LblPoints.Text = "80 UCAS Points"
ElseIf GradeBoundaryPoints >= MPMin And GradeBoundaryPoints <= MPMax Then
LblGrade.Text = "Overall Grade: MP"
LblPoints.Text = "120 UCAS Points"
ElseIf GradeBoundaryPoints >= MMMin And GradeBoundaryPoints <= MMMax Then
LblGrade.Text = "Overall Grade: MM"
LblPoints.Text = "160 UCAS Points"
ElseIf GradeBoundaryPoints >= DMMin And GradeBoundaryPoints <= DMMax Then
LblGrade.Text = "Overall Grade: DM"
LblPoints.Text = "200 UCAS Points"
ElseIf GradeBoundaryPoints >= DDMin And GradeBoundaryPoints <= DDMax Then
LblGrade.Text = "Overall Grade: DD"
LblPoints.Text = "240 UCAS Points"
Else
LblGrade.Text = "Overall Grade: Fail"
End If
End If
If Condition = "3" Then
If GradeBoundaryPoints >= PPPMin And GradeBoundaryPoints <= PPPMax Then
LblGrade.Text = "Overall Grade: PPP"
LblPoints.Text = "120 UCAS Points"
ElseIf GradeBoundaryPoints >= MPPMin And GradeBoundaryPoints <= MPPMax Then
LblGrade.Text = "Overall Grade: MPP"
LblPoints.Text = "160 UCAS Points"
ElseIf GradeBoundaryPoints >= MMPMin And GradeBoundaryPoints <= MMPMax Then
LblGrade.Text = "Overall Grade: MMP"
LblPoints.Text = "200 UCAS Points"
ElseIf GradeBoundaryPoints >= MMMMin And GradeBoundaryPoints <= MMMMax Then
LblGrade.Text = "Overall Grade: MMM"
LblPoints.Text = "240 UCAS Points"
ElseIf GradeBoundaryPoints >= DMMMin And GradeBoundaryPoints <= DMMMax Then
LblGrade.Text = "Overall Grade: DMM"
LblPoints.Text = "280 UCAS Points"
ElseIf GradeBoundaryPoints >= DDMMin And GradeBoundaryPoints <= DDMMax Then
LblGrade.Text = "Overall Grade: DDM"
LblPoints.Text = "320 UCAS Points"
ElseIf GradeBoundaryPoints >= DDDMin And GradeBoundaryPoints <= DDDMax Then
LblGrade.Text = "Overall Grade: DDD"
LblPoints.Text = "360 UCAS Points"
Else
LblGrade.Text = "Overall Grade: Fail"
End If
End If
End Sub

Private Sub CmdReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles CmdReset.Click
PassUnitPoints = 0
MeritUnitPoints = 0
DestinctionUnitPoints = 0
GradeBoundaryPoints = 0
UCASPass = 0
UCASMerit = 0
UCASDestinction = 0
UnitCounter = 0
TrBStatus.Value = Open_GUI.Units
CmdPass.Enabled = True
CmdMerit.Enabled = True
CmdDestinction.Enabled = True
LblPass.Text = "Passes"
LblMerit.Text = "Merits"
LblDistinction.Text = "Destinctions"
LblBoundaryPoints.Text = "0 Grade Boundry Points"
LblGrade.Text = "UCAS Grade: 00"
LblPoints.Text = "0 UCAS Points"
End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs)
End
End Sub

Private Sub ResetToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs)
PassUnitPoints = 0
MeritUnitPoints = 0
DestinctionUnitPoints = 0
GradeBoundaryPoints = 0
UCASPass = 0
UCASMerit = 0
UCASDestinction = 0
UnitCounter = 0
TrBStatus.Value = 0
CmdPass.Enabled = True
CmdMerit.Enabled = True
CmdDestinction.Enabled = True
LblPass.Text = "Passes"
LblMerit.Text = "Merits"
LblDistinction.Text = "Destinctions"
LblBoundaryPoints.Text = "0 Grade Boundry Points"
LblGrade.Text = "UCAS Grade: 00"
LblPoints.Text = "0 UCAS Points"
End Sub

Private Sub AboutToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


MyBase.Load

End Sub

Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As


System.Windows.Forms.ToolStripItemClickedEventArgs)

End Sub

Private Sub Back_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


Back.Click
Open_GUI.Show()
Close()
End Sub

Private Sub LblPoints_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles LblPoints.Click

End Sub

Private Sub LblMerit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles LblMerit.Click

End Sub

Private Sub LblGrade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles LblGrade.Click

End Sub

Private Sub LblBoundaryPoints_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles LblBoundaryPoints.Click
End Sub

Private Sub TrBStatus_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles TrBStatus.Scroll

End Sub

Private Sub LblDistinction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles LblDistinction.Click

End Sub

Private Sub LblBanner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles LblBanner.Click

End Sub

Private Sub LblPass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles LblPass.Click

End Sub
End Class

TESTING
TEST TEST DATA EXPECTED ACTUAL TEST RESULT
USED OUTPUT OUTPUT
CmdPass Allows user to Allowed user Works correctly
enter amount of to enter pass
pass grades grades
CmdMerit Allows user to Allowed user Works
enter amount of to enter merit
merit grades grades
CmdDistinctio Allows user to Allowed user Works
n enter amount of to enter
distinction grades distinction
grades
TrBStatus Shows status of Showed status Works
grade of grade
CmdCalculate Calculates user’s Calculated Works
total grades users total
grades

Note saver

this program show the note that teacher can take for each unit and also they can save and
open it.
Once you write the note you can save it and open it at anytime.

Properties
Public Class Form1
Dim TheDate As DateTime
Dim TheTime As DateTime
Dim theResponse As String

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
TheDate = DateAndTime.Today
TheTime = DateAndTime.TimeOfDay
LblDate.Text = TheDate
LblTime.Text = TheTime
End Sub

Private Sub CmdExit_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles CmdExit.Click
theResponse = MsgBox("Do you want to quit?", MsgBoxStyle.Question +
vbYesNo, "Note Taker PRO")
If theResponse = vbYes Then
MsgBox("Goodbye", MsgBoxStyle.Exclamation, "Note Taker PRO")
Me.Close()
Else
MsgBox("Thanks", MsgBoxStyle.Exclamation, "Note Taker PRO")
End If
End Sub

Private Sub CmdSave1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles CmdSave1.Click, CmdSave2.Click, CmdSave3.Click,
CmdSave4.Click, CmdSave5.Click, CmdSave6.Click, CmdSave7.Click
Dim SaveFile1 As New SaveFileDialog()
SaveFile1.DefaultExt = "*.txt"
SaveFile1.Filter = "Btec Files|*.txt"
If (SaveFile1.ShowDialog() = System.Windows.Forms.DialogResult.OK)
And (SaveFile1.FileName.Length) > 0 Then
Select Case DirectCast(sender, Button).Name
Case CmdSave1.Name
RichTextBox1.SaveFile(SaveFile1.FileName,
RichTextBoxStreamType.PlainText)
Case CmdSave2.Name
RichTextBox2.SaveFile(SaveFile1.FileName,
RichTextBoxStreamType.PlainText)
Case CmdSave3.Name
RichTextBox3.SaveFile(SaveFile1.FileName,
RichTextBoxStreamType.PlainText)
Case CmdSave4.Name
RichTextBox4.SaveFile(SaveFile1.FileName,
RichTextBoxStreamType.PlainText)
Case CmdSave5.Name
RichTextBox5.SaveFile(SaveFile1.FileName,
RichTextBoxStreamType.PlainText)
Case CmdSave6.Name
RichTextBox6.SaveFile(SaveFile1.FileName,
RichTextBoxStreamType.PlainText)
Case CmdSave7.Name
RichTextBox7.SaveFile(SaveFile1.FileName,
RichTextBoxStreamType.PlainText)
End Select
End If
End Sub

Private Sub CmdOpen1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles CmdOpen1.Click, CmdOpen2.Click, CmdOpen3.Click,
CmdOpen4.Click, CmdOpen5.Click, CmdOpen6.Click, CmdOpen7.Click
If OpenFileDialog1.ShowDialog() =
System.Windows.Forms.DialogResult.OK Then
Dim sr As New System.IO.StreamReader(OpenFileDialog1.FileName)
MessageBox.Show(sr.ReadToEnd, "Note Taker PRO")
sr.Close()
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

End Sub

Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles TabPage1.Click

End Sub

Private Sub RichTextBox4_TextChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles RichTextBox4.TextChanged

End Sub
End Class
M2: Improve the user interface and functionality of an event driven
program based on a formal review
To improve my program I have to compare it to other program, I need
to create it more general to show more impression and also I need to
change the background that everyone can see it properly. To improve
it more I have to give to each unit different page and different layout.
The other way to improve my program more buttons which are clear,
stop, resume and also important button is to go back to original page
I can improve it by adding browse button and also I can put MP3 to
make it more interest.

You might also like