P5 new version

advertisement
Masood Mohammad
unit 18
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
Masood Mohammad
Properties for UCAS point
unit 18
Masood Mohammad
unit 18
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
Masood Mohammad
unit 18
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"
Masood Mohammad
unit 18
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)
Masood Mohammad
unit 18
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
Masood Mohammad
unit 18
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
Masood Mohammad
unit 18
Note saver
This program show the note that student 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.
Masood Mohammad
Properties
unit 18
Masood Mohammad
unit 18
Coding for note saver
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
Masood Mohammad
unit 18
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
Masood Mohammad
unit 18
Testing the UCAS calculator and Note Saver
UCAS Calculator
Qualification
# of Passes # of Merits # of Distinctions
BTEC National Diploma
6
3
5
3
2
Qualification
BTEC National
Certifacate
# of Passes
4
6
5
3
4
4
7
2
2
2
# of
Merits
4
3
6
2
4
2
2
5
7
8
# of Distinctions
4
3
5
7
4
Expected
Outcome
Total Points=120
UCAS Points: 120
Overall Grade:
PPP
Total Points=138
UCAS Points: 160
Overall Grade:
MPP
Total Points=144
UCAS Points: 160
Overall Grade:
MPP
Total Points=186
UCAS Points: 200
Overall Grade:
MMP
Actual Outcome Pass/Fail Notes
Total Points=120
UCAS Points: 120
Overall Grade:
PPP
Total Points=138
UCAS Points: 160
Overall Grade:
MPP
Total Points=144
UCAS Points: 160
Overall Grade:
MPP
Total Points=186
UCAS Points: 200
Overall Grade:
MMP
Total
Total Points=180
Points=180
UCAS Points: 240
UCAS Points: 240
Overall Grade:
Overall Grade:
MMM
MMM
Expected
Outcome
Total Points=140
UCAS Points: 200
Overall Grade:
DM
Total Points=126
UCAS Points: 160
Overall Grade:
MM
Total Points=192
UCAS Points: 240
Overall Grade:
DD
Total Points=186
UCAS Points: 200
Overall Grade:
MMP
No mistakes
Pass
No mistakes
Pass
No mistakes
Pass
No mistakes
Pass
No mistakes
Pass
Actual Outcome Pass/Fail Notes
Total Points=140
UCAS Points: 200
Overall Grade:
DM
Total Points=138
UCAS Points: 160
Overall Grade:
MM
Total Points=192
UCAS Points: 240
Overall Grade:
DD
Total Points=186
UCAS Points: 200
Overall Grade:
MMP
Total
Total Points=144
Points=144
UCAS Points: 200
UCAS Points: 200
Overall Grade:
Overall Grade:
DD
DD
No
Pass mistakes
No
Pass mistakes
No
Pass mistakes
No
Pass mistakes
Pass
No
mistakes
Masood Mohammad
Qualification
BTEC National Award
unit 18
# of Passes # of Merits # of Distinctions
9
2
1
7
3
2
11
1
1
8
2
2
9
2
1
Expected
Outcome
Total Points=96
UCAS Points: 120
Overall Grade:
D
Total Points=144
UCAS Points: 0
Overall Grade:
Fail
Total Points=78
UCAS Points: 80
Overall Grade:
M
Total Points=108
UCAS Points: 120
Overall Grade:
D
Total Points=84
UCAS Points: 120
Overall Grade:
D
Actual Outcome Pass/Fail Notes
Total Points=96
UCAS Points: 120 Pass
No mistakes
Overall Grade: D
Total Points=144
UCAS Points: 0
Fail
No mistakes
Overall Grade:
MPP
Total Points=78
UCAS Points: 80
Pass
No mistakes
Overall Grade:
M
Total Points=108
UCAS Points: 120
Pass
No mistakes
Overall Grade:
D
Total Points=84
UCAS Points: 120
Pass No mistakes
Overall Grade:
D
Masood Mohammad
unit 18
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.
To make it more attractive I have to add sound at the
background and make it more professional.
Masood Mohammad
unit 18
Improvement to my program which is below.
I made improvement which I added browser, MP3 and also I have added my name.
The other improvement I have made, is I have changed the colour of my program and also i
create clear button which if there is any error in text than rather than going Exit button to exit
the whole program can go to clear and it will clear the text only.
I think the improvement I have made is more interested than the previous one, because at the
same time doing the note they can also Liston to music, the browser I have create is which
you can go to any website you want to like any useful website.
Masood Mohammad
unit 18
M3: Compare the use and effectiveness of global and local variables
Global
A global variable is that accessible in every scope. Interaction mechanisms with
global variable are called global environment.
Global variable are used extensively to pass information between sections of code
that it don't share it. When a function is defined certain variables used for storing
values are incorporated inside the function. These variables are found and used only
inside these functions. Since functions are separate from the main code, it's
advisable to use variables that are initialized only when a function is called and die
when the execution comes out of the function. Variables that exist only inside a
function are called Local variables.
#include <iostream>
using namespace std;
int main ()
{
// declaring variables:
int a, b;
int result;
// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;
// print out the result:
cout << result;
// terminate the program:
return 0;
Variable
In computer programming a variable is a facility for storing data. The current value of
the variable is the data actually stored in the variable.
All the data that is input a program must be stored somewhere. Programs store this
data in defined memory areas called variables. Once the program ends all the
contents of variables are lost.
There are two main attributes of variables, one of which is a name, find the variable
inside of the program. The other attribute is a data type and what this is that
whatever variable the data can store the data type defines that data.
Download